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