#include <bits/stdc++.h>
using namespace std;
bool isprime(int x) {
  if (x == 1) return false;
  for (int i = 2; i <= sqrt(x); i++)
    if (x % i == 0) return false;
  return true;
}
bool check(long long x) {
  return (long long)(int)sqrt(x) * (int)sqrt(x) == x && isprime(sqrt(x));
}
int main() {
  int n;
  cin >> n;
  long long x;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (check(x)) {
      cout << "YES";
    } else
      cout << "NO";
    cout << endl;
  }
}
