Problem: Alice gave Bob two integers and ( and ). Being a curious boy, Bob wrote down an array of non-negative integers with value of all elements equal to and value of all elements equal to .
What is the shortest possible length of the array Bob wrote?
Recall that the (Minimum EXcluded) of an array is the minimum non-negative integer that does not belong to the array and the of an array is the bitwise XOR of all the elements of the array.
Input Format: The input consists of multiple test cases. The first line contains an integer () — the number of test cases. The description of the test cases follows.
The only line of each test case contains two integers and (; ) — the and of the array, respectively.
Output Format: For each test case, output one (positive) integer — the length of the shortest array with and . We can show that such an array always exists.
Note: In the first test case, one of the shortest arrays with and is .
In the second test case, one of the shortest arrays with and is .
It can be shown that these arrays are the shortest arrays possible.