Aizhan has a sequence of integers S_0, S_1, ..., S_{n-1}. This sequence consists of distinct numbers from to n - 1. Aizhan is trying to sort this sequence in increasing order by swapping some pairs of elements. Her friend Ermek will also perform some swaps, but there is no guarantee that he will do it in a useful way.
Ermek and Aizhan will modify the sequence in several stages. At each stage, Ermek performs a swap first, and then Aizhan performs another swap. More precisely, the one who performs a swap chooses two valid positions and swaps the elements at those positions. Note that the two positions do not have to be different. If they are the same, the element is swapped with itself, and the sequence remains unchanged.
Aizhan knows that Ermek does not care about sorting the sequence . She knows exactly which positions Ermek will choose. Ermek plans to participate in stages. The stages are numbered from to m - 1. For all from to m - 1 inclusive, Ermek will choose positions x_i and y_i at stage .
Aizhan wants to sort the sequence . Before the start of each stage, if Aizhan sees that the sequence is already sorted in increasing order, the whole process stops. Given the initial sequence and the positions that Ermek is going to choose, you need to find a sequence of swaps that Aizhan can use to sort the sequence . In some subtasks, it is required to find the shortest possible sequence of swaps. It is guaranteed that the sequence can be sorted in or fewer stages.
If Aizhan sees that the sequence is sorted after the swap performed by Ermek, she may choose a swap with equal positions (for example, and ). As a result, the sequence will remain sorted after the stage ends, and Aizhan will achieve her goal. Also note that if the sequence is initially sorted, then the minimum number of stages required is .
Given the sequence , the number of swaps , and the sequences of positions and , find a sequence of swaps that Aizhan can use to sort the sequence .
The first line contains the length of the sequence .
The second line contains the initial sequence S_0, S_1, ..., S_{n-1}~(n \le 200000).
The next line contains the number of swaps m~(m \le 3 \cdot n) planned by Ermek.
Each of the following lines contains a pair of integers x_i and y_i. They mean that at stage (0 \le i \le m - 1) Ermek plans to swap the elements at positions x_i and y_i.
In the first line, print the number of swaps made by Aizhan.
In the next lines, print the sequence of swaps of minimal length that Aizhan can use to sort .
Each line should contain a pair of positions p_i and q_i to be swapped.
Example 1. Suppose that:
Initial sequence: S = 4, 3, 2, 1, 0.
Ermek is going to perform six swaps (m = 6).
The sequences and describing the positions Ermek will choose are: X = 0, 1, 2, 3, 0, 1 and Y = 1, 2, 3, 4, 1, 2. That is, the pairs of positions Ermek plans to choose are (0, 1), (1, 2), (2, 3), (3, 4), (0, 1) and .
In this case, Aizhan can transform the sequence into 0, 1, 2, 3, 4 in three stages. She can do this by choosing positions (0, 4), (1, 3), and then . The following table shows how Ermek and Aizhan modify the sequence .

Example 2. Suppose that:
Initial sequence: S = 3, 0, 4, 2, 1.
Ermek is going to perform five swaps (m = 5).
The pairs of positions Ermek plans to choose are: (1, 1), (4, 0), (2, 3), (1, 4) and .
In this case, Aizhan can sort the sequence in three stages, for example by choosing pairs (1, 4), (4, 2), and then . The following table shows how Ermek and Aizhan modify the sequence .

Example 1
Example 2