"I hereby challenge you, Ponyvillians: anything you can do, I can do better. Any takers? Anyone? Or is Trixie destined to be the greatest equine who has ever lived!?!" ¡ª "Boast Busters"
Given two permutation \(P_0\) && \(P_1\) of {0, 1, ..., n - 1}, we define the crossing number of it as follows. Write \(P_0\) from left to right above \(P_1\) and draw a straight line between each same elements. The crossing number of \(P_0\) and \(P_1\) is the number of pairs of lines that cross.
For example, if n = 5, and \(P_0\) = {0, 1, 2, 3, 4}, and \(P_1\) = {1, 3, 0, 2, 4}, then the crossing number of \(P_0\) and \(P_1\) is 3, as shown in the figure below.
[center][img]../../../data/images/C531-1004-1.png[/img][/center]
Now given you the two permutation, you need to implement the following operations:
[ul][li]SWAP $p$ $a$ $b$: swap $P_p[a]$ and $P_p[b]$ ($0\leq p\leq 1$, $0\leq a, b\leq n-1$).[/li][li]QUERY: ask the crossing number of the current $P_0$ and $P_1$.[/li][/ul]
Input
Input contains multiple test cases (less than 10). For each test case, the first line contains one integer $n \; (1 \leq n \leq 10^5)$.
The second line contains n integers $P_0[0]$, $P_0[1]$, ..., $P_0[n-1]$.
The third line contains n integers $P_1[0]$, $P_1[1]$, ..., $P_1[n-1]$.
The next line contains one integer q ¡ª¡ª the number of operations ($1 \leq q \leq 10^5$). The next q line, each line will contains a operation as we mentioned above.
Output
For each query, output the corresponding result in one line.