#include <bits/stdc++.h>
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long n;
    int m;
    scanf("%I64d", &n);
    m = sqrt(n);
    if ((long long)m * (long long)m != n || m == 1)
      puts("NO");
    else {
      int l = 0;
      for (int i = 2; i * i <= m; i++) {
        if (m % i == 0 && m != 2) {
          l = 1;
          break;
        }
      }
      if (l == 1)
        puts("NO");
      else
        puts("YES");
    }
  }
  return 0;
}
