| Udmurt SU Contest 2011 |
|---|
| Finished |
All Rabbit's friends-and-relations play a leapfrog. Today, $$$n$$$ of them have stood in a straight line and begun to play. How do they play a leapfrog? They do it as follows:
Rabbit's friends-and-relations are quite small, so any of them can easily fit into pretty the same place.
First line contains the only integer $$$n$$$ ($$$1 \leq n \leq 100$$$).
Second line contains $$$n$$$ numbers $$$a_i$$$ separated by spaces — initial positions of Rabbit's friends-and-relations on the line. So $$$i$$$-th person stands in position $$$a_i$$$.
Third line contains $$$n$$$ numbers separated by spaces — desired positions of Rabbit's friends-and-relations. Current positions are considered desired iff it is possible to permute numbers of current positions in such a way that the list of positions' numbers becomes equal to the list of desired positions' numbers.
All the numbers are integers ranging from $$$1$$$ to $$$100$$$ inclusive.
Output "No" if Rabbit's friends-and-relations will never come into desired positions.
Otherwise, output "Yes" and then output the performed leapfrogs (you can output none, if it's the case). Each next line should contain a pair of numbers $$$X$$$ and $$$Y$$$ for each time when $$$X$$$ jumps over $$$Y$$$'s back (Rabbit's friends-and-relations' names are $$$1$$$, $$$2$$$, $$$\ldots$$$, $$$n$$$).
The number of jumps shouldn't exceed $$$5 \cdot 10^5$$$, and no one should ever stand in a position that is more than $$$10^8$$$ units far from position $$$0$$$.
2 1 2 5 6
Yes 1 2 2 1 1 2 2 1
2 1 2 1 3
No
2 10 20 20 30
Yes 1 2
| Name |
|---|


