You are given array \(A\), \(B\) each containing \(N\) inetegers. You have to create array \(C\) of \(N\) inetegers where \(C_i = A_i \mathbin{\&} B_i\) (Here, \(\mathbin{\&}\) denotes the Bitwise AND operation). You can shuffle elements of \(A\), \(B\) however you want. Find maximum value of \(C_1 \mathbin{\&} C_2 \mathbin{\&} \dots \mathbin{\&} C _N\).
Input format
- The first line contains \(T\) denoting the number of test cases. The description of \(T\) test cases is as follows:
- For each test case:
- The first line contains an integer \(N\) denotes size of array \(A\), \(B\).
- The next line contains \(N\) space-separated integers \(A_1, A_2, \dots, A_N\) - denoting the elements of \(A\).
-
The next line contains \(N\) space-separated integers \(B_1, B_2, \dots, B_N\) - denoting the elements of \(B\).
Output format
For each test case, print maximum value of \(C_1 \mathbin{\&} C_2 \mathbin{\&} \dots \mathbin{\&} C _N\) in a separate line.
Constraints
\(1 \leq T \leq 10^5 \\ 1 \leq N \leq 10^5\\ \\0\leq A_i, B_i \leq 10^9\)
The sum of \(N\) over all test cases does not exceed \(10^5\).