Gopal is teaching data structures to his students. He told the students that in a tree adding one more edge will definitely form a cycle. After the class a student went to Gopal and asked the length of the cycle formed by adding an edge in a tree. But Gopal doesn't know the answer to the problem. He needs a day to answer them. He needs your help in finding the solution. The problem is as follows.
Gopal has an infinite binary tree. Now he joins two nodes A and B. He wants to know the length of the cycle formed. The tree is numbered as follows.
root -> 1 left child -> 2 x parent right child -> 2 x parent + 1You need to help him by telling him the length of the cycle formed.
Note: The line joining A and B will not cross any other node.
Input:
First line of the input contains T denoting the number of test cases. Then T lines follow each
of the line containing two integers A and B.
Output:
output the required answer in a new line for each test case
Constraints;
1<=A, B<=1018
Sample Input:
3 2 3 2 7 5 15Sample Output:
3 4 6Explaination