#include using namespace std; using ll = long long; void solve() { ll n; cin >> n; if (n == 1) { puts("No"); return; } int cnt = 0; while (n%2) { cnt++; if (cnt > 3) { puts("No"); return; } n /= 2; } for (ll i = 3; i*i <= n; ++i) { if (n%i != 0) continue; while (n%i == 0) { n /= i; cnt++; if (cnt > 3) { puts("No"); return; } } } if (n != 1) cnt++; if (cnt == 3) puts("Yes"); else puts("No"); } int main() { int t; cin >> t; while (t--) solve(); return 0; }