## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] The Lost Array CodeChef Solution | CodeChef Problem Solution 2022

JJ had an array $A$ of length $N$ such that $0\le {A}_{i}<{2}^{30}$ for all $1\le i\le N$.
He listed down the XOR of all the subsequences of $A$ of size $\ge \left(N-1\right)$ in some random order. Let's call the XOR of these $\left(N+1\right)$ subsequences as ${B}_{1},{B}_{2},\dots ,{B}_{N+1}$.

Unfortunately, he lost the initial array $A$. Can you help him recover it?

If there are multiple arrays which satisfy the given conditions, print any. Also, it is guaranteed that corresponding to the given input, an answer always exists.

### Input Format

• The first line will contain $T$ - the number of test cases. Then the test cases follow.
• The first line of each test case contains an integer $N$ - the size of the initial array $A$.
• The second line of each test case contains $\left(N+1\right)$ integers ${B}_{1},{B}_{2},\dots ,{B}_{N+1}$ - the XOR of all the

•  subsequences of $A$ of size $\ge \left(N-1\right)$ in some random order.

### Output Format

For each test case, output $N$ integers ${A}_{1},{A}_{2},\dots ,{A}_{N}$ which satisfy the given conditions.

If multiple answers exist, print any.

### Constraints

• $1\le T\le {10}^{5}$
• $2\le N\le 2\cdot {10}^{5}$
• $0\le {B}_{i}<{2}^{30}$
• Sum of $N$ over all test cases does not exceed