#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int M = 100005; vector isPrime(M); vector prime; for (int i = 2; i < M; i++){ if (isPrime[i]) continue; prime.push_back(i); for (int j = i; j < M; j+= i){ isPrime[j] = 1; } } int q; cin >> q; for (int i = 0; i < q; i++){ long long a; cin >> a; vector facts; bool ok = true; for (auto p : prime){ if (a%p) continue; while (a%p == 0){ facts.push_back(p); a /= p; } } if (a != 1) facts.push_back(a); if (ok && facts.size() == 3){ cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }