Topological Sort#505

Topological Sort

2 seconds
128 megabytes
Medium (≈1350)

You are given a directed, unweighted graph. Perform a topological sort of its vertices.

Input

The first line contains two integers: the number of vertices n~(1 \le n \le 10^5) and the number of edges m~(1 \le m \le 10^5) in the graph. The following lines describe the edges of the graph, each given by a pair of integers — the start and end vertex numbers.

Output

If a topological sort of the graph is possible, print any valid topological ordering of the vertices as a sequence of vertex numbers. If the graph cannot be topologically sorted, print .

Examples

Example 1

Loading
Loading