#include <bits/stdc++.h> #define dbg(x) std::cerr << #x << "=" << x << "\n" using i64 = long long; int tot; int prime[100005], vis[100005]; const double eps = 1e-15; void shai(int n){ for(int i = 2; i <= n; i++){ if(!vis[i]) prime[tot++] = i; for(int j = 0; j < tot; j++){ if(1LL * prime[j] * i > n) break; vis[1LL * prime[j] * i] = 1; if(prime[j] % i == 0) break; } } } bool isit(i64 a){ i64 t = std::pow(a, 0.5); if (t * t == a || (t + 1) * (t + 1) == a) return 1; t = pow(a, 1.0 / 3); if (t * t * t == a || (t + 1) * (t + 1) * (t + 1) == a || (t + 2) * (t + 2) * (t + 2) == a) return 1; return 0; } void solve(){ i64 n; std::cin >> n; if(isit(n)){ std::cout << "yes\n"; return ; } for(int i = 0; i < tot; i++){ if(n % prime[i] == 0){ int b = 0; while(n % prime[i] == 0){ n /= prime[i]; b++; } if(b == 1){ n = 0; break; } } } if (n == 1) std::cout << "yes\n"; else std::cout << "no\n"; } int main(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cerr << std::fixed << std::setprecision(15); shai(4000); int T; std::cin >> T; //dbg(tot); while(T--){ solve(); } return 0; }