import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines t,*ab = map(int, read().split()) def calc(a,b): res = [] if(a^b < a): length = 0 for i in range(60): if (1< b: length = i break for i in range(length-1,0,-1): if(a&b) >> i : a -= (1<>i)!=(b>>i): break if(a==0): a += (1< a): if(a & (1 << r_bit)): res.append(1 << r_bit) a += (1 << r_bit) r_bit += 1 res2 = [] for i in range(60): if(b^(1<>i)&1 : res2.append(1<