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