#include <bits/stdc++.h>
using namespace std;
#define int long long
int prime[50000],nprime=1;
int mark[50000],pal[50005];
vector<int>primes;
void sieve(int n){
int i,j,limit=sqrt(n*1)+2;
mark[1]=1;
for(i=4;i<=n;i+=2)mark[i]=1;
prime[2]=nprime;
nprime++;
primes.push_back(2);
for(i=3;i<=n;i+=2){
if(!mark[i]){
primes.push_back(i);
prime[i]=nprime;
nprime++;
if(i<=limit){
for(j=i*i;j<=n;j+=i*2){
mark[j]=1;
}
}
}
}
}
int32_t main () {
cin.tie(0)->sync_with_stdio(0);
int t = 1;
cin >> t;
sieve(3e4);
while (t--) {
int n, x, ans = INT_MAX;
cin >> n;
if (n%2) {
ans = n;
for (int i = 0; primes[i]*primes[i] <= n; i++) {
if (n%primes[i] == 0) {
ans = min (ans, primes[i]);
}
}
ans = n/ans;
}
else ans = n/2;
cout << ans << "\n";
}
}