#include <bits/stdc++.h>
using namespace std;
int part(int n) {
vector<int> dif(n - 1);
for (int i = 0; i < n - 1; ++i) {
dif[i] = abs((i + 2) - (i + 1));
}
for (int length = 2; length <= n / 2; ++length) {
if (n % length != 0) {
continue;
}
bool is_possible = true;
for (int i = 0; i < n - 1; i += length) {
int max_diff = *max_element(dif.begin() + i, dif.begin() + i + length - 1);
int min_diff = *min_element(dif.begin() + i, dif.begin() + i + length - 1);
if (max_diff != min_diff) {
is_possible = false;
break;
}
}
if (is_possible) {
return n / length;
}
}
return 1;
}
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
cout << part(n) << endl;
}
return 0;
}