import sys,os,io input = sys.stdin.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline T = int(input()) for t in range(T): A, B = map(int, input().split()) n = B.bit_length() ans = [] for i in range(n-1): if A&(1<