A. An X-Camp Transformer Game
time limit per test
4 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

X-Camp Academy is a coding academy with a full spectrum of levels of class offerings. In its summer camp, students play a game during breaks and winners get a transformer badge.

The students are first given non-negative integer sequences $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$ of length $$$n$$$.

In one operation, they can choose an integer $$$1 \le i \le n$$$, and do the following:

  • For all $$$1 \le j \lt i$$$, replace $$$a_j$$$ with $$$a_j | a_i$$$.
  • For all $$$i \lt j \le n$$$, replace $$$a_j$$$ with $$$a_j \& a_i$$$.

Here, $$$|$$$ and $$$\&$$$ denote the bitwise OR and AND operations respectively.

The goal of the game is to perform the operation exactly $$$n$$$ times, choosing a distinct integer in each operation, so that in the end, $$$a=b$$$.

Please help construct the solution to win the X-Camp transformer badge, or determine that there is no solution!

Input

Input consists of multiple tests. The first line contains $$$t$$$, the number of tests ($$$1 \le t \le 10^5$$$).

The first line of each test contains $$$n$$$ ($$$1 \le n \le 3\cdot 10^5$$$).

The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$).

The third line contains $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ ($$$0 \le b_i \le 10^9$$$).

It is guaranteed the sum of $$$n$$$ over all tests does not exceed $$$3\cdot 10^5$$$.

Output

For each test, if the goal is unachievable, output -1.

Otherwise, output $$$n$$$ integers $$$p_1, p_2, \ldots, p_n$$$, meaning that at the $$$i$$$-th step, you perform the operation with index $$$p_i$$$. ($$$1 \le p_i \le n$$$).

All $$$p_i$$$ must be distinct. If there are multiple answers, you can output any.

Example
Input
4
3
1 2 3
3 2 2
1
1000000000
1000000000
2
1 5
69 420
5
0 1 2 3 4
0 1 2 3 4
Output
2 1 3 
1 
-1
-1
Note

In the first test,

  • After the operation with $$$i=2$$$, $$$a=[1|2,2,3\&2]=[3,2,2]$$$.
  • After the operation with $$$i=1$$$, $$$a=[3,2\&3,2\&3]=[3,2,2]$$$.
  • After the operation with $$$i=3$$$, $$$a=[3|2,2|2,2]=[3,2,2]$$$.

Note that other sequences of operations may be possible and would be accepted, such as $$$[2,3,1]$$$.

In the second test, note that the goal may already be achieved at the start. Regardless, we are still forced to perform an operation.

In the third and fourth tests, we can show there are no solutions.