Topological Sort
Very easy
Execution time limit is 2 seconds
Runtime memory usage limit is 128 megabytes
Given a directed unweighted graph. Topologically sort its vertices.
Input
The first line contains the number of vertices and the number of edges in a graph. In the following lines, the edges of the graph are listed, each of which is defined by a pair of numbers — the indices of the starting and ending vertices.
Output
Print any topological sort of the graph as a sequence of vertex numbers. If the graph cannot be topologically sorted, then print .
Examples
Input #1
Answer #1
Submissions 8K
Acceptance rate 36%