A Shortest Path in a Directed Graph


Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Find a shortest directed path from s to t by BFS, enqueueing smaller neighbors first.

Input

The first line contains n, m, s, and t. The next m lines contain directed edges.

  • 1 <= s, t <= n <= 1000

Output

Print the selected shortest path, or -1 if t is unreachable.

Example

Input
6 6 1 6
1 3
1 2
2 4
3 4
4 5
5 6
Output
1 2 4 5 6

Comments

There are no comments at the moment.