T = int(input()) for i in range(T): A,B = map(int,input().split()) ans = [] while A < B: x = 1 while A+2*x <= B and A % (2*x) == 0: x *= 2 ans.append(x) A += x print(len(ans)) print(*ans)