T = int(input()) AB = [list(map(int,input().split())) for _ in range(T)] for a,b in AB: ans = [] k = 0 a2 = a a3 = a while a2 % 2 == 0: k += 1 a2 //= 2 while (b-a)//2 > pow(2,k): ad = pow(2,k) a += ad ans.append(ad) k += 1 while b > a: ad = pow(2,k) if b >= a + ad: a += ad ans.append(ad) if k > 0: k -= 1 print(len(ans)) print(*ans) #print(a3 + sum(ans))