def Eratosthenes(N): #N以下の素数のリストを返す N+=1 is_prime_list = [True]*N m = int(N**0.5)+1 for i in range(3,m,2): if is_prime_list[i]: is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1) return [2] + [i for i in range(3,N,2) if is_prime_list[i]] M = 10**5+2 primes = [i for i in Eratosthenes(M) if i%4 != 3] lst = [[] for _ in range(M)] for i in range(1,M): x = i*i+1 for p in primes: if p*p > x: break while x%p==0: lst[i].append(p) x //= p if x > 1: lst[i].append(x) Q,*qs = map(int,open(0).read().split()) for x in qs: print(*lst[x])