404504: GYM101521 H Pokemon GO
Description
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.
InputThe 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)
OutputIf 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.
ExamplesInput4 4 2000Output
1 4
1 2 350
2 3 500
3 4 150
1 4 1600
1 2 3 2 3 4Input
3 3 5000Output
2 2
1 2 480
1 3 360
2 3 90
ImpossibleNote
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.