#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define endl '\n'
#define Endl '\n'
using namespace std;
const int N = 2e5 + 5;
int tc, n, m, a[N];
// sieve
bool is_prime[N];
vector<int> primes;
void sieve() {
fill(is_prime, is_prime + N, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i < N; i++) {
if (is_prime[i]) {
primes.push_back(i);
for (int j = i + i; j < N; j += i) {
is_prime[j] = false;
}
}
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); // cout.tie(0);
sieve();
cin >> tc;
while (tc--) {
cin >> n;
int Ans = 1;
for (auto x : primes) {
if (x > n) {
break;
}
if (n % x == 0) {
Ans = n / x;
break;
}
}
cout << Ans << endl;
}
return 0;
}