J. Subarray Reversals
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given a sequence of $$$n$$$ non-negative integers $$$a$$$. You can perform the following operation on it.

Pick a pair of indices $$$l, r$$$ $$$(1 \le l \le r \le n)$$$ such that $$$a_l \oplus a_{l+1} \oplus \dots a_r \neq 0$$$ and reverse the subarray $$$a_l, a_{l+1}, \dots a_r$$$. Here, $$$\oplus$$$ represents the bitwise XOR operation.

Given $$$b$$$ which is a permutation of $$$a$$$, find a sequence of at most $$$2n$$$ such operations that transform $$$a$$$ into $$$b$$$. It can be shown that such a sequence always exists.

Input

The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of each test case follows.

The first line contains a single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^3$$$) — the number of integers in $$$a$$$.

The next two lines contain $$$n$$$ space separated integers each, the elements of $$$a$$$ and $$$b$$$ respectively ($$$0 \le a_i, b_i \le 10^9$$$). It is guaranteed that $$$b$$$ is a permutation of $$$a$$$.

It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$5 \cdot 10^3$$$.

Output

For each test case, print $$$k$$$ ($$$0 \le k \le 2 \cdot n$$$) — the number of operations to be performed on $$$a$$$ followed by $$$k$$$ lines containing integers $$$l_i$$$ and $$$r_i$$$ $$$(1 \le l_i \le r_i \le n)$$$, indicating that in the $$$i^\text{th}$$$ operation the subarray $$$[l_i, r_i]$$$ of $$$a$$$ is to be reversed.

Example
Input
3
3
1 2 1
2 1 1
5
1 5 2 4 3
2 3 5 1 4
4
3 2 7 3
7 3 3 2
Output
1
1 2
3
2 4
1 3
2 5
2
2 4
1 3