#include <bits/stdc++.h>
using namespace std;
int N = 1000007;
vector<int> v(N);
vector<int> dp(N);
vector<int> ans(N);
int main() {
  for (int i = 1; i <= N; i++) {
    v[i] = i;
  }
  for (int i = 2; i <= N; i++) {
    if (v[i] == i) {
      for (int j = 2 * i; j <= N; j += i) {
        v[j] = min(v[j], i);
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    dp[i] = i / v[i];
  }
  ans[1] = dp[1];
  for (int i = 2; i <= N; i++) {
    ans[i] = max(dp[i], ans[i - 1]);
  }
  int t;
  cin >> t;
  while (t--) {
    int l;
    cin >> l;
    cout << ans[l] << endl;
  }
}
