#include <bits/stdc++.h>
using namespace std;
#define int long long
int prime[500000],nprime=1;
int mark[500000],pal[500005];
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(1e5);
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";
}
}