import math def get_divisors(n): divisors = set() for i in range(1, int(math.isqrt(n)) + 1): if n % i == 0: divisors.add(i) divisors.add(n // i) return sorted(divisors, reverse=True) def solve(): import sys input = sys.stdin.read().split() T = int(input[0]) idx = 1 for _ in range(T): A = int(input[idx]) B = int(input[idx+1]) idx +=2 path = [] current = B found = False while current > A: delta = current - A if delta > 0 and A % delta == 0: path.append(delta) current = A break divisors = get_divisors(current) chosen = None for d in divisors: if d == current: continue prev = current - d if prev >= A and prev % d == 0: chosen = d break if chosen is not None: path.append(chosen) current -= chosen else: path.append(1) current -= 1 path.reverse() print(len(path)) print(' '.join(map(str, path))) solve()