def make_divisors(n): lower_divisors, upper_divisors = [], [] i = 1 while i**2 <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n // i) i += 1 return lower_divisors + upper_divisors[::-1] T = int(input()) for _ in range(T): a, b = map(int, input().split()) divs = make_divisors(a) ans = [] while a < b: while a + divs[-1] > b: divs.pop() a += divs[-1] ans.append(divs[-1]) assert a == b print(len(ans)) print(*ans)