#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
void getYue(int x) {
vector<int> res;
for (int i = 1; i <= x / i; i ++ ) {
if (x % i == 0) {
res.push_back(i);
if (!(x / i == i)) res.push_back(x / i);
}
}
sort(res.begin(), res.end());
for (auto y : res) cout << y << " ";
cout << endl;
}
int main() {
int n, x;
cin >> n;
while (n -- ) {
cin >> x;
getYue(x);
}
}