| Bay Area Programming Contest 2024 |
|---|
| Finished |
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:
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 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$$$.
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.
431 2 33 2 211000000000100000000021 569 42050 1 2 3 40 1 2 3 4
2 1 3 1 -1 -1
In the first test,
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.
| Name |
|---|


