#include <bits/stdc++.h>
using namespace std;
template <typename tn>
inline tn next(void) {
  tn k;
  cin >> k;
  return k;
}
template <typename tn>
inline ostream& operator<<(ostream& os, const vector<tn>& v) {
  for (unsigned i = 0; i < v.size(); i++) os << v[i] << ' ';
  return os;
}
inline bool isPrime(int e) {
  if (e <= 1) return 0;
  for (int i = 2; i <= sqrt(e); i++)
    if (!(e % i)) return 0;
  return 1;
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T = next<int>();
  while (T--) {
    long long a = next<long long>();
    double s = sqrt(a);
    if (s == (int)s && isPrime(s))
      puts("YES");
    else
      puts("NO");
  }
  return ~~(0 - 0);
}
