def get_divisors(x):
res = []
i = 1
while i <= x / i:
if x % i == 0:
res.append(i)
if i != x // i:
res.append(x // i)
i += 1
res.sort()
return res
if __name__ == '__main__':
n = int(input())
for i in range(n):
x = int(input())
res = get_divisors(x)
for j in res:
print(j, end=' ')
print('')