Course Order
There are UPEEC courses. Each pair a b means course must be finished before course . Print an order to take all courses — when several courses are available, take the smallest-numbered first. Print IMPOSSIBLE if there's a cycle.
Input
and , then lines a b.
Output
The order, or IMPOSSIBLE.
Constraints
,
Sample 1
Input
4 3 1 2 1 3 3 4
Output
1 2 3 4
Sample 2
Input
2 2 1 2 2 1
Output
IMPOSSIBLE