from math import gcd import sys sys.setrecursionlimit(10000000) input = sys.stdin.readline for _ in range(int(input())): a, b = map(int, input().split()) res = [] while a != b: k = gcd(a, b) res.append(k) a += k print(" ".join(map(str, res)))