def solve(): import sys input = sys.stdin.read().split() idx = 0 T = int(input[idx]) idx += 1 for _ in range(T): A = int(input[idx]) B = int(input[idx+1]) idx +=2 # Check if B - A is a divisor of A if (B - A) > 0 and A % (B - A) == 0: print(1) print(B - A) continue reverse_path = [] current = B while current > A: max_d_candidate = current - A d = None # Find the largest divisor <= max_d_candidate for candidate in range(max_d_candidate, 0, -1): if current % candidate == 0: d = candidate break reverse_path.append(d) current -= d # Reverse to get the forward path reverse_path.reverse() print(len(reverse_path)) print(' '.join(map(str, reverse_path))) if __name__ == '__main__': solve()