Problem Description

Given n and a list of swaps (i j), start with [1..n]. Apply swaps and print the final array.

Input Format

First line n q. Next q lines i j (1-based).

Output Format

One line n integers.

Sample Test Case

Input:
5 3 1 5 2 4 3 4
Output:
5 4 2 3 1

Constraints

n,q

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next