#include <stdio.h> int main () { int q = 0; long long a = 0LL; int res = 0; long long p[100000] = {}; int pcnt = 0; int flag[100001] = {}; for (int q = 2; q <= 100000; q++) { if (flag[q] <= 0) { p[pcnt] = (long long)q; pcnt++; for (int r = 2; q*r <= 100000; r++) { flag[r*q] = 1; } } } res = scanf("%d", &q); while (q > 0) { int cnt = 0; res = scanf("%lld", &a); for (int i = 0; i < pcnt; i++) { while (a%p[i] == 0LL) { cnt++; a /= p[i]; } } if ((cnt == 3 && a == 1LL) || (cnt == 2 && a > 1LL)) { printf("Yes\n"); } else { printf("No\n"); } q--; } return 0; }