404504: GYM101521 H Pokemon GO

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Pokemon GOtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Be a Pokemon trainer! In Pokemon GO, you can collect eggs from Pokestops. An egg can be hatched by putting it in an incubator, followed by walking a certain distance in the real world.

Being a smart trainer, Ian is trying to find ways to maximize his egg hatching efficiency. The city has N pokestops, numbered 1 to N, and there are M two-way routes connecting pairs of Pokestops. The ith route is Li meters long. No two routes connect the same pair of Pokestops. Also, no route connect a Pokestop to itself. It is always possible to reach any Pokestop from a Pokestop.

Ian is now at Pokestop A and he wishes to arrive at Pokestop B after the walk. Help him find a path that is exactly K meters long. While he is allowed to visit a Pokestop zero or more times and use a route zero or more times, he cannot return in the middle of a route. There is no need to maximize the number of Pokestop visits.

Input

The first line contains three integers N, M, K – the number of Pokestops, the number of routes, and the required path length respectively. (2 ≤ N ≤ 1000, , )

The second line contains two integers A and B – the starting and ending Pokestops. A and B are not necessarily different.

The next M lines describe the routes. Each line contains three integers Xi, Yi, Li, meaning that the route connects Pokestops Xi and Yi and its length is Li. (1 ≤ Xi, Yi ≤ N, Xi ≠ Yi, 1 ≤ Li ≤ 109)

Output

If there is no path of exactly K meters long, output Impossible.

Otherwise output any valid path, which is the order of the Pokestops that Ian should visit.

ExamplesInput
4 4 2000
1 4
1 2 350
2 3 500
3 4 150
1 4 1600
Output
1 2 3 2 3 4
Input
3 3 5000
2 2
1 2 480
1 3 360
2 3 90
Output
Impossible
Note

The first sample corresponds to the image in the statement. The sample output path length = 350 + 500 + 500 + 500 + 150 = 2000 .

In the second sample, it is easy to see that there is no path of length 5000 because all route lengths are multiples of 30.

加入题单

算法标签: