Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EIPRF - Treasures

Mr. A assigned Mr. B the task of writing a program to print the signs for the game "Finding the Treasure", information about signboards including the names of the places where the boards are to be placed and the names of the areas to go. However, after receiving the result, Mr. A discovers a bug in Mr. B's program so that the result contains a series of signs that, after following the signs, players will return to the original position (Example: a to b , b to c, c to a). Mr. A wants to write a software to prove it. Note that the game will start at location 0.

Input

The first line contains 2 positive integers n, m (n, m ≤ 10 ^ 5) which are the number of places and the number of signboards that Mr. B has printed.

For the next m lines, each line is a signpost, including the name of the place and the place to go, separated by a space.

Each location is numbered from 0 to n-1.

Output

Output the cycle. Note that all testcases which have cycles, have one cycle contains place 0.

Example:

Input

4 5

3 1

0 1

1 2

3 0

2 0

Output

0 1 2


In ra đường đi có đường đi bị lặp đầu tiên – Sắp xếp danh sách đỉnh của các đường đi theo thứ tự từ điểnIn ra đường đi bị lặp đầu tiên theo thứ tự tăng dần (vòng lặp có điểm đầu nhỏ nhất).

More e.g.

3 3
0 2
2 1
1 0

Added by:Ha Minh Ngoc
Date:2016-01-12
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: GOSU
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.