#include using namespace std; using ll = long long; ll fct(ll x, int n) { return (n > 2 ? x * x * x : (n > 1 ? x * x : (n == 1 ? x : 1))); } bool isNumOfPrime(ll x, int n) { if (n == 0) { return x <= 1; } int fl = 2; while (fct(fl, n) <= x) { if (x % fl == 0) { while (x % fl == 0) { x /= fl; } return isNumOfPrime(x, n - 1); } } return n == 1; } int main() { int Q; cin >> Q; while (Q--) { ll N; cin >> N; cout << (isNumOfPrime(N, 3) ? "Yes" : "No") << endl; } }