import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) def calc(A, B): res = [] while A + A <= B: res.append(A) A += A dif = B - A cnt = 0 while A % 2 == 0: cnt += 1 A >>= 1 while dif: for i in reversed(range(cnt + 1)): val = 1 << i if dif >= val: dif -= val res.append(val) cnt = i + 1 break print(len(res)) print(*res, sep=" ") T = int(input()) query = tuple(tuple(map(int, input().split())) for _ in range(T)) for a, b in query: calc(a, b)