#include <bits/stdc++.h>
using namespace std;
bool prime(int n) {
  int count = 0;
  if (n == 2 || n == 3 || n == 5 || n == 7) return true;
  if (n % 2 == 0) return false;
  for (int i = 3; i * i <= n; i++) {
    if (n % i == 0) {
      count++;
      break;
    }
  }
  if (count == 0)
    return true;
  else
    return false;
}
int main() {
  int n;
  cin >> n;
  while (n--) {
    long long a;
    cin >> a;
    long long b = sqrt(a), count = 0;
    if (prime(b) && pow(b, 2) == a && a != 1) {
      cout << "YES" << endl;
      ;
    } else {
      cout << "NO" << endl;
      ;
    }
  }
}
