#include using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int pf(long long a) { int res = 0; while (a % 2 == 0) { a /= 2; res++; } for (long long i = 3; i * i <= a; i += 2) { while (a % i == 0) { a /= i; res++; } } if (a > 1) { res++; } return res; } int main() { fast_io(); int t; cin >> t; for (; t--;) { long long a; cin >> a; cout << (pf(a) == 3 ? "Yes" : "No") << '\n'; } }