Given two numbers A and B. Find the value of pair (P,Q) such that A ≤ P < Q ≤ B value of P AND Q is maximum where AND is a binary operator. Refer to this link for more information about AND operator : http://en.wikipedia.org/wiki/Bitwise_operation#AND 

Input:
First line of input contains number of test cases T. Each test case contains two numbers A and B.  

Output: 
For each test case print the value of maximum AND.  

*Constraints: * 
1 ≤ T ≤ 1000
1 ≤ A < B ≤10^18

SAMPLE INPUT
2
2 3
4 8
SAMPLE OUTPUT
2
6
T=int(raw_input())
while T>0:
    A,B=map(int,raw_input().split()) 
    if (B-A==1): print(A&B)
    elif (B-A==2 and A%2==0 and B%2!=0): print(A&B)
    elif (B-A==2 and A%2==0 and B%2==0): print(A&(B-1))
    elif (B-A==2 and A%2!=0 and B%2!=0): print((A+1)&B)
    elif (B-A==2 and A%2!=0 and B%2==0): print(A&B)
    elif (B-A>=3 and A%2!=0 and B%2!=0): print((B-1)&B) 
    elif (B-A>=3 and A%2!=0 and B%2==0): print((B-2)&(B-1)) 
    elif (B-A>=3 and A%2==0 and B%2!=0): print((B-1)&B)  
    elif (B-A>=3 and A%2==0 and B%2==0): print((B-2)&(B-1))
    T-=1