https://codeforces.com/problemset/problem/1294/C
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
int t; cin>>t;
while(t--)
{
int n; cin>>n;
bool flag=0;
for(int i=2;i<=n/i;i++)
{
if(n%i==0)
{
int temp=n/i;
for(int j=2;j<=temp/j;j++)
{
if(temp%j==0)
{
int a=i,b=j,c=temp/j;
if(a==b||a==c||b==c) continue;
puts("YES");
cout<<j<<" "<<temp/j<<" "<<i<<endl;
flag=1;
break;
}
}
}
if(flag) break;
}
if(!flag) puts("NO");
}
return 0;
}