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())

def test(x, i):
	return (x >> i) & 1 == 1
	
def slow(a, b):
	return max(i & j for i in range(a, b + 1) for j in range(i + 1, b + 1))

def f(a, b):
	if b - a == 1:
		return a & b
	return max(b & (b - 1), (b - 1) & (b - 2))

for _ in range(t):
	a, b = map(int, raw_input().split())
	print(f(a, b))