#include <bits/stdc++.h>
using namespace std;
bool isprime(int x) {
  if (x == 2) return 1;
  if (x == 0 or x == 1) return 0;
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return 0;
  return 1;
}
int main() {
  int n;
  long long x;
  cin >> n;
  while (n--) {
    cin >> x;
    long long lim = (long long)sqrt(double(x));
    if (lim * lim == x and isprime(lim))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
