XOR Sequence Revisited

Jerry loves XOR sequence. He has an array A. The array is described below: • A0 = 1 • Ax =Ax−1⊕xforx>0(⊕issymbolofXOR) First few elements of the array are [1, 0, 2, 1, 5, 0, 6, 1, 9]. Given a range [L,R], find the AND of all the elements between AL and AR (inclusive), i.e. You need to find AL&AL+1&AL+2& . . . &AR where & is the symbol of bitwise AND operator. Input First line will contain an integer number T (1 ≤ T ≤ 100000), denoting number of test cases. Each of the next T lines contains one test case. Each test case will contain two integers L and R (0 ≤ L ≤ R ≤ 1015). Output For each case, print the answer in a single line. Sample Input 2 24 22 Sample Output 0 2