For an array $A$ consisting of integers. Perform a sequence of $q$ operations to swap two elements in array $A$, resulting in a new array $B$. Given array $B$, restore the original array $A$.
### Input
- The first line contains two integers $n,q$.
- The second line contains $n$ integers $B_i$.
- The next $q$ lines each contain two indices $x,y$ with $1 \le x,y \le n$, representing the operation to swap elements at positions $x$ and $y$ in array $A$.
### Output
- Output $n$ integers representing the original array $A$.
### Constraints
- $1 \le n,q, B_i \le 1000$.
### Example
Input:
```
5 4
1 2 3 4 5
1 2
2 4
3 1
1 5
```
Output:
```
4 3 5 2 1
```