E. Swap to Rearrange
time limit per test
5 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

You are given $$$2$$$ arrays, $$$a$$$ and $$$b$$$, both of length $$$n$$$. You can perform the following operation:

  • Choose an index $$$i$$$ ($$$1 \le i \le n$$$) and swap $$$a_i$$$ with $$$b_i$$$.

You can perform the operation any number of times (possibly zero), but each index can be chosen by at most one operation. Your task is to make $$$a$$$ a rearrangement of $$$b$$$ after all operations, or state that it is impossible. You do not have to minimize the number of operations.

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.

The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^6$$$).

The second line of each test case contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \leq a_i \leq n$$$).

The third line of each test case contains $$$n$$$ integers $$$b_1,b_2,\ldots,b_n$$$ ($$$1 \leq b_i \leq n$$$).

It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.

Output

For each test case, output $$$-1$$$ if it is impossible to make $$$a$$$ a rearrangement of $$$b$$$. Otherwise, output two lines in the following format:

  • In the first line, print the number of operations $$$s$$$ ($$$0 \leq s \leq n$$$).
  • In the second line of each test case, print $$$s$$$ numbers – the indices you select in each operation in order. You should guarantee that each index is chosen at most once.

If there are multiple possible answers, you many output any.

Example
Input
4
4
1 1 3 3
2 2 4 4
3
1 2 1
3 3 1
3
1 2 3
2 3 1
4
1 2 2 4
3 1 4 3
Output
2
2 4
-1
0

2
3 4
Note

In the first test case, the operations performed are swap($$$a_2, b_2$$$) and swap($$$a_4,b_4$$$), which will make $$$a = [1,2,3,4]$$$ and $$$b = [2,1,4,3]$$$. Now it is possible to achieve $$$a$$$ by rearranging the elements of $$$b$$$.

In the second test case, it can be shown that no matter what operations we do, we cannot make $$$a$$$ a rearrangement of $$$b$$$.