#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long num;
    scanf("%I64d", &num);
    long long m = num;
    long long sq = sqrt(m);
    long long sq2 = sq;
    bool flg = false;
    if (m == sq * sq && m > 3 && (m % 2 || m == 4)) {
      for (int i = 3; i <= sqrt(sq2); i += 2) {
        if (sq % i == 0) {
          flg = true;
          break;
        }
      }
      if (!flg) {
        printf("YES\n");
      } else
        printf("NO\n");
    } else
      printf("NO\n");
  }
}
