def divisor(n):
ans=[]
i=1
while i<=n//i:
if n%i==0:
ans.append(i)
if i!=n//i:
ans.append(n//i)
i+=1
ans.sort()
for item in ans:
print(item,end=' ')
print()
n=int(input())
while n:
n-=1
x=int(input())
divisor(x)