In this problem, you are given two permutations a and b of n numbers, and you need to play a game with them! In this game, you are required to perform the following steps:
For example, let us consider two permutations (5, 4, 2, 1, 3) and (2, 5, 4, 1, 3). The following picture shows the permutations after drawing all line segments. In the picture, the number of intersections between the line segments is 2.
Given the permutations a and b, your task is to play the game and to count number of intersections between the line segments. Can you?
The first line contains an integer T (1 ≤ T ≤ 100), in which T is the number of test cases.
The first line of each test case contains an integer n (1 ≤ n ≤ 105), in which n is the size of permutations.
Then a line follow containing n distinct integers a1, a2, ..., an (1 ≤ ai ≤ n), giving the first permutation a.
Then a line follow containing n distinct integers b1, b2, ..., bn (1 ≤ bi ≤ n), giving the second permutation b.
The sum of n overall test cases does not exceed 7 × 105.
For each test case, print a single line containing the number of intersections between the line segments.
## Input
The first line contains an integer T (1 ≤ T ≤ 100), in which T is the number of test cases.The first line of each test case contains an integer n (1 ≤ n ≤ 105), in which n is the size of permutations. Then a line follow containing n distinct integers a1, a2, ..., an (1 ≤ ai ≤ n), giving the first permutation a. Then a line follow containing n distinct integers b1, b2, ..., bn (1 ≤ bi ≤ n), giving the second permutation b.The sum of n overall test cases does not exceed 7 × 105.
## Output
For each test case, print a single line containing the number of intersections between the line segments.
[samples]
**Definitions**
Let $ n \in \mathbb{Z} $ be the number of regions, with $ 6 \leq n \leq 36 $.
Let $ V = (v_1, v_2, \dots, v_n) \in \mathbb{Z}^n $ be the target sum for each region, where $ 1 \leq v_i \leq 21 $.
Let $ R \in \{1, \dots, n\}^{6 \times 6} $ be the region assignment matrix, where $ R[i][j] $ denotes the region index of cell $ (i,j) $.
Let $ S \in \{1, \dots, 6\}^{6 \times 6} $ be the solution grid to be determined.
**Constraints**
1. **Region Sum Constraint**: For each region $ k \in \{1, \dots, n\} $,
$$
\sum_{\substack{(i,j) \in \{1,\dots,6\}^2 \\ R[i][j] = k}} S[i][j] = v_k
$$
2. **Row Constraint**: For each row $ i \in \{1, \dots, 6\} $,
$$
\{ S[i][1], S[i][2], \dots, S[i][6] \} = \{1, 2, 3, 4, 5, 6\}
$$
3. **Column Constraint**: For each column $ j \in \{1, \dots, 6\} $,
$$
\{ S[1][j], S[2][j], \dots, S[6][j] \} = \{1, 2, 3, 4, 5, 6\}
$$
4. **Block Constraint**: For each of the six $ 2 \times 3 $ disjoint blocks $ B_\ell $ ($ \ell \in \{1, \dots, 6\} $),
$$
\bigcup_{(i,j) \in B_\ell} \{ S[i][j] \} = \{1, 2, 3, 4, 5, 6\}
$$
**Objective**
Find any grid $ S \in \{1, \dots, 6\}^{6 \times 6} $ satisfying all constraints above.