13279 - Rearrange   

Description

There are N students in line according to the seat number, then M pairs of students exchanged their positions in the sequence.

Can you help the teacher find everyone's position according to the seat number 1 ~ N?

 

For example, N = 4 M = 3, and three exchanges are:

1 2

2 3

3 4

The seat arrangement of students during the exchange process:

1 2 3 4

-> 2 1 3 4

-> 2 3 1 4

-> 2 3 4 1

The final positions of students 1 ~ N are 4 1 2 3

Input

The first line contains two integers N M, the number of students and the number of pairs who exchange positions.

Each of the next M lines contains two integers a b, indicating the seat exchange.

 

for all test case:

1 <= a, b <= N, M <= 1000

Output

The positions of students after exchanges. Note that you need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss