#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool v(vector<int>& a, int p) {
int n = a.size();
int np = n / p;
for (int i = 0; i < np; ++i) {
int s = i * p;
int e = s + p - 1;
int mi = *min_element(a.begin() + s, a.begin() + e + 1);
int ma = *max_element(a.begin() + s, a.begin() + e + 1);
if ((ma - mi) != (a[p - 1] - a[0])) {
return false;
}
}
return true;
}
int m(vector<int>& a, int n) {
int l = 2, h = n / 2, ans = 1;
while (l <= h) {
int m = l + (h - l) / 2;
if (v(a, m)) {
ans = m;
l = m + 1;
} else {
h = m - 1;
}
}
return ans;
}
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
a[i] = i + 1;
}
int mx = m(a, n);
cout << mx << endl;
}
return 0;
}