#include using namespace std; using ll = long long; using ull = unsigned long long; using Matrix = vector>; const int inf = 1000000000; const ll INF = 1000000000000000000; const ll mod = 998244353; const ull mod_hash = (1UL << 61) - 1; const vector dx = {0, 1, 0, -1, 1, 1, -1, -1}; const vector dy = {1, 0, -1, 0, 1, -1, 1, -1}; int prime(ll x) { int res = 0; while (x % 2 == 0) { res++; x /= 2; } while (x % 3 == 0) { res++; x /= 3; } for (ll i = 1; (6 * i - 1) * (6 * i - 1) <= x; i++) { while (x % (6 * i - 1) == 0) { res++; x /= (6 * i - 1); } while (x % (6 * i + 1) == 0) { res++; x /= (6 * i + 1); } } if (x != 1) { res++; } return res; } int main(){ int Q;cin>>Q; while(Q--){ ll a;cin>>a; if(prime(a) ==3){ cout<<"Yes"<