#include using i64 = long long; int solve() { i64 n; std::cin >> n; int cnt = 0; for (i64 i = 2; i * i <= n; ++i) { while (n % i == 0) { n /= i; cnt += 1; if (cnt > 3) { std::cout << "No" << '\n'; return 0; } } } if (n > 1) cnt += 1; std::cout << (cnt == 3 ? "Yes" : "No") << '\n'; return 0; } int main() { std::cin.tie(nullptr)->sync_with_stdio(false); int _; std::cin >> _; while (_--) solve(); return 0; }