#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int MX = 100'010; bool table[MX + 10]; vector pns; void precalc() { rep(i, MX) { if (i <= 1) table[i] = true; if (table[i]) continue; pns.push_back(i); for (ll j = i * 2; j < MX; j += i) table[j] = true; } } void solve() { ll a; cin >> a; ll cnt = 0; bool ok = true; for (const auto pn : pns) { if (!ok || a < pn) break; while (a % pn == 0) { a /= pn; cnt += 1; if (cnt > 3) { ok = false; break; } } } ok &= (cnt == 3 && a == 1) || (cnt == 2 && a > 1); cout << (ok ? "Yes" : "No") << '\n'; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; cin >> T; precalc(); for (int t = 0; t < T; t++) { solve(); } return 0; }