#include<bits/stdc++.h>
using namespace std;
const long long M=2e5+1,MOD=1000000007;
typedef long long ll;
vector<int>prime;
void precalculate_prime(){
prime.push_back(2);
for(ll i=3;i*i<=1e9;i+=2){
int x=1;
for(auto it:prime){
if(it*it>i)break;
if(i%it==0){
x=0;
break;
}
}
if(x)prime.push_back(i);
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
precalculate_prime();
int t=1;
cin>>t;
while(t--){
int n;
cin>>n;
int res=1;
for(auto it:prime){
if(n%it==0){
res=n/it;
break;
}
}
cout<<res<<"\n";
}
return 0;
}