#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n;
  long long int a, sq;
  cin >> n;
  while (n--) {
    cin >> a;
    sq = sqrt(a);
    for (j = 2; j * j <= sq; j++) {
      if (sq % j == 0) break;
    }
    if ((j * j > sq) && (sq * sq == a) && (a > 1))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
