#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); vector tb(50001, true); vector p; p.reserve(5133); tb[0] = tb[1] = false; p.push_back(2); for(int i = 4; i <= 50000; i += 2) tb[i] = false; for(int i = 3; i <= 50000; i += 2){ if(!tb[i]) continue; p.emplace_back(i); for(int j = i, d = 2 * i; j <= 50000; j += d) tb[j] = false; } int Q; cin >> Q; while(Q--){ ll v; cin >> v; int cnt = 0; for(int i = 0; i < 5133 && p[i] * p[i] <= v; i++){ while(v % p[i] == 0){ v /= p[i]; cnt++; } } if(v != 1) cnt++; cout << (cnt == 3 ? "Yes" : "No") << '\n'; } }