#include <bits/stdc++.h>
using namespace std;
int isPrime(int x);
int main() {
  int N, x;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x;
    isPrime(x);
  }
  return 0;
}
int isPrime(int x) {
  int cnt = 3;
  if (x == 1) {
    return 0;
  } else if (x == 2) {
    cout << x << endl;
    return 0;
  } else {
    while (cnt < sqrt(x)) {
      if (x % cnt == 0) {
        return 0;
      }
      cnt = cnt + 2;
    }
    cout << x << endl;
    return 0;
  }
}
