#Qua2202. Biggest Bitwise-Or

Biggest Bitwise-Or

Description

Given two natural numbers l,rl,r, you need to choose two integers x,yx,y that satisfy lxyrl\le x\le y\le r, and maximize xyx|y.

The operator | represents bitwise-or operation.

Format

Input

The first line contains one integer T(1T10001)T(1\le T\le 10001) --- the number of test cases.

Each test case consists of one line containing two integers l,r(0lr1018)l,r(0\le l \le r\le 10^{18}).

Output

For each test case, print a single integer --- the maximum bitwise-or result xyx|y.

Samples

4
1 10
0 1
1023 1024
233 322
15
1
2047
511