/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
vector<ll>primes;
vector<pair<ll,ll> >factors;
void findfactors(int n)
{
int count;
for(int i=2;i*i<=n;i++)
{
if(n%i==0)
{
count=0;
while(n%i==0)
{
count++;
n=n/i;
}
factors.push_back(make_pair(i,count));
}
}
if(n!=1)
{
factors.push_back(make_pair(n,1));
}
}
bool solve(int n)
{
findfactors(n);
int t=factors.size();
cout<<t<<"\n";
if(t>=3)
{
return true;
}
if(t==1)
{
for(auto p:factors){
if(p.second>=6)
{
return true;
}
else
{
return false;
}
}
}
if(t==2)
{
int pro=1;
for(auto p:factors)
{
pro*=p.first;
}
int temp=n/pro;
for(auto p:factors)
{
if(temp%(p.first)==0)
{
return true;
}
}
}
return false;
}
int main()
{
//seive();
int t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
if(solve(n))
{
cout<<"YES"<<"\n";
}
else
{
cout<<"NO"<<"\n";
}
}
return 0;
}