This problem is special judge.
To accerlelate judging, we will use offline judge.
You should test your program with this zip file(like lab):
140.114.86.238/DS/prob3.zip (windows)
prob3_Mac.zip
If you have confidence with your code, please sumbit your C or C++ code to this link:
140.114.86.238/DS/topo.php
Please write a program to implement topological sort.
There are many cases in input.
The first line in the input contains three integers: n and m, representing the number of nodes in the graph, the number of edges in the graph.
The next m lines, each line contains 2 integers, u and v (1<= u, v <= n). That means there is an edge between u and v. There is at most one edge between two nodes.
Input will be terminated by EOF (End-Of-File).
1 <= n <= 100000
0 <= m <=500000
Input 1: O(n!) can pass this
Input 2: O(n2) can pass this
Input 3: O(n+m) can pass this
For each case, output one line with the traversal order of DFS from the source.
We will test your program by special judge. So you can pass the testing data if you give valid topological order.