def f(a):
i = 1
s = set()
while i <= a // i:
if a % i == 0:
s.add(i)
s.add(a//i)
i+=1
for v in sorted(s):
print(v, end = ' ')
print()
n = int(input())
for t in range(n):
a = int(input())
f(a)