Problem I. Innovations

Author:A. Klenin, I. Tuphanov   Time limit:1 sec
Input file:input.txt   Memory limit:256 Mb
Output file:output.txt  

Statement

Once upon a time in a galaxy far, far away there was a planet with an extensive government of N officials. Some officials were subordinates of others.

The main task of the government were to implement innovations. Each innovation was implemented in the following way: first, the innovation, along with some budget, is assigned to one of the officials. The official takes some of the budget and reassigns the innovation to one of his subordinates. This process repeats until innovation reaches the official without subordinates, who takes the remaining budget. At this point, innovation is declared to be implemented.

The government considers the innovation to be optimally implemented if every official is involved in the implementation.

Your program must, given the superior-subordinate relationships, find an order in which officials should be involved in the optimal implementation of the innovation.

Input file format

Input file contains integers N M, followed by M pairs of integers ui vi. Each pair designates that the official number vi is subordinate of the official number ui (1 ≤ ui, vi ≤ N, ui ≠ vi).

It is guaranteed that there are no cycles in the superior-subordinate relationship.

Output file format

Output file must contain N integers — numbers of officials in the order they should process the innovation. If there is no solution, output single number 0. If there is more that one solution, output any of them.

Constraints

2 ≤ N ≤ 103; 1 ≤ M ≤ 105

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
3 3
1 3 
3 2 
1 2
1 3 2
2
3 2
1 2
1 3
0

0.088s 0.008s 13