CF2131E Adjacent XOR
Description
You're given an array $$$a$$$ of length $$$n$$$. For each index $$$i$$$ such that $$$1 \\le i < n$$$, you can perform the following operation at most once:
- Assign $$$a\_i := a\_i \\oplus a\_{i+1}$$$, where $$$\\oplus$$$ denotes the bitwise XOR operation. .
You can choose indices and perform the operations in any sequential order.
Given another array $$$b$$$ of length $$$n$$$, determine if it is possible to transform $$$a$$$ to $$$b$$$.
Input Format
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 one integer $$$n$$$ ($$$2 \\le n \\le 2 \\cdot 10^5$$$).
The second line of each test case contains $$$n$$$ integers $$$a\_1, a\_2, \\dots, a\_n$$$ ($$$0 \\le a\_i < 2^{30}$$$).
The third line of each test case contains $$$n$$$ integers $$$b\_1, b\_2, \\dots, b\_n$$$ ($$$0 \\le b\_i < 2^{30}$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \\cdot 10^5$$$.
Output Format
For each test case, output "YES" (quotes excluded) if $$$a$$$ can be transformed to $$$b$$$; otherwise, output "NO". You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
Explanation/Hint
In the first test case, you can perform the operations in the following order:
1. Choose index $$$i=3$$$ and assign $$$a\_3 := a\_3 \\oplus a\_4 = 7$$$, and $$$a$$$ becomes $$$\[1, 2, 7, 4, 5\]$$$.
2. Choose index $$$i=4$$$ and assign $$$a\_4 := a\_4 \\oplus a\_5 = 1$$$, and $$$a$$$ becomes $$$\[1, 2, 7, 1, 5\]$$$.
3. Choose index $$$i=1$$$ and assign $$$a\_1 := a\_1 \\oplus a\_2 = 3$$$, and $$$a$$$ becomes $$$\[3, 2, 7, 1, 5\]$$$.