#include <bits/stdc++.h>
using namespace std;
bool check_partition(int n, int length) {
if (n % length != 0) {
return false;
}
for (int i = 0; i < n; i += length) {
int max_element = i + length;
int min_element = i + 1;
for (int j = i + 1; j < i + length; ++j) {
if (max_element < n && max_element < j + 1) {
max_element = j + 1;
}
if (min_element < n && min_element > j + 1) {
min_element = j + 1;
}
}
if (abs(max_element - min_element) != 1) {
return false;
}
}
return true;
}
int max_partition(int n) {
int max_partition = 1;
for (int length = 2; length <= sqrt(n); ++length) {
if (check_partition(n, length)) {
max_partition = n / length;
}
}
return max_partition;
}
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
cout << max_partition(n) << endl;
}
return 0;
}