#include <bits/stdc++.h>
using namespace std;
int main() {
  int tt;
  cin >> tt;
  while (tt--) {
    int is_ans_shown = 0;
    long long int k;
    cin >> k;
    long long int root = sqrt(k);
    if (root * root != k) {
      cout << "NO" << endl;
      is_ans_shown = 1;
    } else {
      if (root % 2 == 0) {
        if (root == 2) {
          cout << "YES" << endl;
          is_ans_shown = 1;
        } else {
          cout << "NO" << endl;
          is_ans_shown = 1;
        }
      } else {
        if (root == 1) {
          cout << "NO" << endl;
          is_ans_shown = 1;
        }
        int root_of_root = sqrt(root);
        for (int i = 3; i <= root_of_root; i += 2) {
          if (root % i == 0) {
            cout << "NO" << endl;
            is_ans_shown = 1;
            break;
          }
        }
        if (is_ans_shown == 0) cout << "YES" << endl;
      }
    }
  }
}
