T = int(input()) for case in range(T): A,B = map(int,input().split()) if B-A <= 120: #20: print(B-A) ans = [1]*(B-A) print(*ans) continue ans = [] Flag = False for i in range(120): tempA = A*1 kaisu = 0 while tempA%2 == 0: kaisu += 1 tempA //= 2 beki = pow(2,kaisu) if B <= A+beki: nokori = B - A for j in reversed(range(kaisu)): if (nokori>>j)&1 == 1: ans.append(pow(2,j)) break else: A += beki ans.append(beki) print(len(ans)) print(*ans) #print(sum(ans))