#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

const int N = 1e5+3;
ll p[N + 3];

void sang() {
    fill(p + 1, p + N + 1, true);
    p[0] = p[1] = false;
    for(ll i = 2; i * i <= N; i++) {
        if(p[i]) {
            for(ll j = i * i; j <= N; j += i) {
                p[j] = false;
            }
        }
    }
}

ll n, t;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    freopen("CAU3.INP", "r", stdin);
    freopen("CAU3.OUT", "w", stdout);
    sang();
    cin >> t;
    while(t--) {
        cin >> n;
        while (!p[n]) {
            n++;
        }
        cout << n << '\n';
    }
    return 0;
}
