import math
n = int(input())
for _ in range(n):
val = int(input())
ans = []
for i in range(1, int(math.sqrt(val)) + 1):
if val % i == 0:
ans.append(i)
if val // i != i:
ans.append(val // i)
ans.sort()
for v in ans:
print(f'{v} ', end='')
print()