#include <bits/stdc++.h>
using namespace std ;

typedef long long ll;
#define pb  push_back
#define M_PIl          3.141592653589793238462643383279502884L /* pi */

void solve(){
    int n,a,b,c=1,cnt=0,e=0;
    cin>>n;
    vector<int> v;
    int m=n;
set<int> s;

    for(int i=2;i<m;i++){

        if(n%i==0 &&e==1){
            cnt++;
            if (!s.count(i)){
            s.insert(i);
            }
            n=n/i;
            i--;
        }
        else if(n%i==0 && e==0){
                cnt++;
            a=i;
        s.insert(i);
        e=1;

        }

        if(n/i==0){b=i;break;}

    }

    if(s.size()+cnt<6){cout<<"NO"<<endl;}
    else{
        if(s.size()==1){
                if(v.size()<6){cout<<"NO"<<endl; return;}
                else{
            b=a*a;

            c=(m/a)/b;
        }
        }

        else {
            c=m/(a*b);

        }

        cout<<"YES"<<endl<<a<<" "<<b<<" "<<c<<endl;

    }
}

    int main(){
        int t;
        cin>>t;
        while(t--){
            solve();
        }

    return 0;
    }


#include <bits/stdc++.h>
using namespace std ;

typedef long long ll;
#define pb  push_back
#define M_PIl          3.141592653589793238462643383279502884L /* pi */

void solve(){
    ll n;
    int a,b,c=1,cnt=0,e=0;
    cin>>n;

    ll m=n;
set<int> s;

    for(int i=2;i<=m/2;i++){

        if(n%i==0 &&e==1){
                if(i!=a){b=i;}
            cnt++;
            if (!s.count(i)){
            s.insert(i);
            }
            n=n/i;
            i--;
        }
        else if(n%i==0 && e==0){
                cnt++;
                n=n/i;
            a=i;
        s.insert(i);
        e=1;
        i--;

        }
        if(s.size()==1 && cnt==6){break;}
        if(s.size()==3){break;}
        if(cnt>6){break;}
        if(n==1){break;}
    }

    if(s.size()+cnt<6){cout<<"NO"<<endl;}
    else{
        if(s.size()==1){
                if(cnt<6){cout<<"NO"<<endl; return;}
                else{
            b=a*a;

            c=(m/a)/b;
        }
        }
        else {
            c=m/(a*b);

        }
        cout<<"YES"<<endl<<a<<" "<<b<<" "<<c<<endl;
    }
}

    int main(){
        int t;
        cin>>t;
        while(t--){
            solve();
        }

    return 0;
    }


#include <bits/stdc++.h>
using namespace std ;

typedef long long ll;
#define pb  push_back
#define M_PIl          3.141592653589793238462643383279502884L /* pi */

void solve(){
    ll n;
    cin>>n;
    ll m=n;
    int a=1,b=1,c=1,d=0,cnt=0,e=0;

    for(int i=2;i<=sqrt(m);i++){

        if(n%i==0){
            cnt++;
            if(e==0){a=i;e++;d++;}
            else if(i!=a){b=i;d++;}
            n=n/i;

        }
        if(cnt==6){break;}

    }
    if(cnt<2){cout<<"NO"<<endl;}
    else{
    if(d>=2;cnt>=2){
            c=m/(a*b);

    }

    if(a!=c && c!=b ){
            if(b>1&&c>1)cout<<"YES"<<endl<<a<<" "<<b<<" "<<c<<endl;
            else{cout<<"NO"<<endl;}
    }
    else{cout<<"NO"<<endl;}

}
}

    int main(){
        int t;
        cin>>t;
        while(t--){
            solve();
        }

    return 0;
    }


#include <bits/stdc++.h>
using namespace std ;

typedef long long ll;
#define pb  push_back
#define M_PIl          3.141592653589793238462643383279502884L /* pi */

void solve(){
    int n,a,b,c=1,cnt=0,k;
    cin>>n;
    vector<int> v;
    int m=n;
set<int> s;

    for(int i=2;i<=m;i++){

        if(n%i==0){

            v.push_back(i);
            s.insert(i);
            n=n/i;
            i--;
        }
        if(n/i==0){break;}

    }

    if(s.size()+v.size()<6){cout<<"NO"<<endl;}
    else{
        a=v[0];
        if(s.size()==1){
                if(v.size()<6){cout<<"NO"<<endl; return;}
                else{
            b=v[1]*v[2];
            for(int i=3;i<v.size();i++){
            c*=v[i];
        }
        }
        }
        else {
            b=v[v.size()-1];
            for(int i=1;i<v.size()-1;i++){
            c*=v[i];
        }
        }

        cout<<"YES"<<endl<<a<<" "<<b<<" "<<c<<endl;
    }

}

    int main(){
        int t;
        cin>>t;
        while(t--){
            solve();
        }

    return 0;
    }


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scl3(a,b,c)          scanf("%lld%lld%lld",&a,&b,&c);
#define scl2(a,b)            scanf("%lld%lld",&a,&b)
#define scd(n)               scanf("%lf",&n)
#define srt(g)               sort(g.begin(),g.end())
#define rvs(g)               reverse(g.begin(),g.end())
#define pl                   pair<long long,long long>
#define pll                  pair<long long,pair<long long,long long>>
#define ll long long
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define f first
#define s second
int main()
{
    ll t;
    scl(t);
    while(t--)
    {
        ll n;
        scl(n);
        ll m=n;
        ll k=0,flag=0;
        ll p[5];
        ll j=0;
        for(ll i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                p[j]=i;
                j++;
            }
            if(j==2)
            {
                ll x=n/(p[0]*p[1]);
                if(x!=p[0] && x!=p[1])
                {
                    cout << "YES\n" << p[0] << " " << p[1] << " " << x << "\n";
                    flag=1;
                    break;
                }
            }
        }
        if(!flag)cout << "NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
                //cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=3)
        {
            cout << "YES" << endl;
            cout << prime[0] << " " << prime[1] << " " << prime[2] << endl;
        }
        if(prime.size()==2)
        {
            if(div[0]>=3)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << prime[1] << endl;
            }
            else if(div[1]>=3)
            {
                cout << "YES" << endl;
                cout << prime[1] << " " << prime[1]*prime[1] << " " << prime[0] << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << prime[0]*prime[0]*prime[0] << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
                //cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=3)
        {
            cout << "YES" << endl;
            cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
        }
        if(prime.size()==2)
        {
            if(div[0]+div[1]>=4)
            {
               cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
               // cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << b << endl;
        if(b!=1)
        {
            prime.pb(b);
            div.pb(1);
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=2)
        {
            //cout << "YES" << endl;
            if(n%(prime[0]*prime[1])==0 && n/(prime[0]*prime[1])!=prime[0] && n/(prime[0]*prime[1])!=prime[1] && n/(prime[0]*prime[1])!=1 && n/(prime[0]*prime[1])!=1)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scl3(a,b,c)          scanf("%lld%lld%lld",&a,&b,&c);
#define scl2(a,b)            scanf("%lld%lld",&a,&b)
#define scd(n)               scanf("%lf",&n)
#define srt(g)               sort(g.begin(),g.end())
#define rvs(g)               reverse(g.begin(),g.end())
#define pl                   pair<long long,long long>
#define pll                  pair<long long,pair<long long,long long>>
#define ll long long
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define f first
#define s second
int main()
{
    ll t;
    scl(t);
    while(t--)
    {
        ll n;
        scl(n);
        ll m=n;
        ll k=0,flag=0;
        ll p[5];
        ll j=0,x;
        for(ll i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                p[j]=i;
                j++;
            }
            if(j==2)
            {
                if(n%(p[0]*p[1])==0)
                {
                    x=n/(p[0]*p[1]);
                    if(x!=p[0] && x!=p[1] && x!=1)
                    {
                        cout << "YES\n" << p[0] << " " << p[1] << " " << x << "\n";
                        flag=1;
                        break;
                    }
                }
                else
                {
                    j--;
                }
            }
        }
        if(!flag)cout << "NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
               // cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        if(b!=0)
        {
            prime.pb(b);
            div.pb(1);
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=2)
        {
            //cout << "YES" << endl;
            if(n%(prime[0]*prime[1])==0 && n/(prime[0]*prime[1])!=prime[0] && n/(prime[0]*prime[1])!=prime[1] && n/(prime[0]*prime[1])!=1 && n/(prime[0]*prime[1])!=1)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
                //cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=2)
        {
            //cout << "YES" << endl;
            if(n%(prime[0]*prime[1])==0 && n/(prime[0]*prime[1])!=prime[0] && n/(prime[0]*prime[1])!=prime[1])
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
                //cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=3)
        {
            cout << "YES" << endl;
            cout << prime[0] << " " << prime[1] << " " << prime[2] << endl;
        }
        if(prime.size()==2)
        {
            if(div[0]+div[1]>=4)
            {
               cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << prime[0]*prime[0]*prime[0] << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scl3(a,b,c)          scanf("%lld%lld%lld",&a,&b,&c);
#define scl2(a,b)            scanf("%lld%lld",&a,&b)
#define scd(n)               scanf("%lf",&n)
#define srt(g)               sort(g.begin(),g.end())
#define rvs(g)               reverse(g.begin(),g.end())
#define pl                   pair<long long,long long>
#define pll                  pair<long long,pair<long long,long long>>
#define ll long long
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define f first
#define s second
int main()
{
    ll t;
    scl(t);
    while(t--)
    {
        ll n;
        scl(n);
        ll m=n;
        ll k=0,flag=0;
        ll p[5];
        ll j=0,x;
        for(ll i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                p[j]=i;
                j++;
            }
            if(j==2)
            {
                if(n%(p[0]*p[1])==0)
                {
                    x=n/(p[0]*p[1]);
                    if(x!=p[0] && x!=p[1] && x!=1)
                    {
                        cout << "YES\n" << p[0] << " " << p[1] << " " << x << "\n";
                        flag=1;
                        break;
                    }
                }
            }
        }
        if(!flag)cout << "NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
                //cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=2)
        {
            //cout << "YES" << endl;
            if(n%(prime[0]*prime[1])==0 && n/(prime[0]*prime[1])!=prime[0] && n/(prime[0]*prime[1])!=prime[1] && n/(prime[0]*prime[1])!=1 && n/(prime[0]*prime[1])!=1)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
                //cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=2)
        {
            //cout << "YES" << endl;
            if(n%(prime[0]*prime[1])==0 && n/(prime[0]*prime[1])!=prime[0] && n/(prime[0]*prime[1])!=prime[1])
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000015];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
               // cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << b << endl;
        if(b>=1000001)
        {
            prime.pb(b);
            div.pb(1);
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=2)
        {
            //cout << "YES" << endl;
            if(n%(prime[0]*prime[1])==0 && n/(prime[0]*prime[1])!=prime[0] && n/(prime[0]*prime[1])!=prime[1] && n/(prime[0]*prime[1])!=1 && n/(prime[0]*prime[1])!=1)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
                //cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=3)
        {
            cout << "YES" << endl;
            cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
        }
        if(prime.size()==2)
        {
            if(div[0]+div[1]>=4)
            {
               cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define mp make_pair
bool a[1000005];
ll i,j;
int main()
{
    for(i=2; i*i<=1000005; )
    {
        if(a[i]==0)
        {
            for(j=i; (i*j)<=1000005; j++)
            {
                a[i*j]=1;
            }
        }
        if(i==2)
        {
            i++;
        }
        else
        {
            i+=2;
        }
    }
    //cout << "1" << endl;
    vector<ll>c;
    c.pb(2);
    for(i=3; i<1000005; i=i+2)
    {
        if(a[i]==0)
        {
            c.pb(i);
        }
    }
    vector<ll>prime,div,divnumber,v;
    // cout << "2" << endl;
    ll t;
    scl(t);
    ll n,k,cs=1;
    while(t--)
    {
        scl(n);
        ll b=n,cnt=0;
        //cout << "3" << endl;
        for(j=0; j<c.size(); j++)
        {
            if(b%c[j]==0)
            {
                cnt=0;
                prime.pb(c[j]);
                while(b%c[j]==0)
                {
                    b=b/c[j];
                    cnt++;
                }
                div.pb(cnt);
               // cout << c[j] << " " << cnt << endl;
                //divs=divs*cnt;
            }
        }
        //cout << b << endl;
        if(b>=1000001)
        {
            prime.pb(b);
            div.pb(1);
        }
        //cout << cnt << endl;
        if(cnt==0)
        {
           cout << "NO" << endl;
           continue;
        }
        //cout << "4" << endl;
        if(prime.size()>=2)
        {
            //cout << "YES" << endl;
            if(n%(prime[0]*prime[1])==0 && n/(prime[0]*prime[1])!=prime[0] && n/(prime[0]*prime[1])!=prime[1] && n/(prime[0]*prime[1])!=1 && n/(prime[0]*prime[1])!=1)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[1] << " " << n/(prime[0]*prime[1]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        if(prime.size()==1)
        {
            if(div[0]>=6)
            {
                cout << "YES" << endl;
                cout << prime[0] << " " << prime[0]*prime[0] << " " << n/(prime[0]*prime[0]*prime[0]) << endl;
            }
            else
            {
                cout << "NO" << endl;
            }
        }
        prime.clear();
        div.clear();
    }
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e5+5;
bool vis[maxn];
int prime[maxn],cnt=0;
int main()
{
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		ll a[5];
		ll cnt=0;
		int flag=0;
		for(int i=2;i<=maxn;i++){
			if(n%i==0){
				n/=i;
				cnt++;
				a[cnt]=i;
			}
			if(i>=n||n>maxn){
				flag=1;
				break;
			}
			if(cnt==2) break;
		}
		if(flag) cout<<"NO"<<endl;
		else{
			cout<<"YES"<<endl;
			cout<<a[1]<<" "<<a[2]<<" "<<n<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e5+5;
bool vis[maxn];
int prime[maxn],cnt=0;
int main()
{
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		ll a[5];
		ll cnt=0;
		int flag=0;
		for(int i=2;i<=maxn;i++){
			if(n%i==0){
				n/=i;
				cnt++;
				a[cnt]=i;
			}
			if(i>=n){
				flag=1;
				break;
			}
			if(cnt==2) break;
		}
		if(flag) cout<<"NO"<<endl;
		else{
			cout<<"YES"<<endl;
			cout<<a[1]<<" "<<a[2]<<" "<<n<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e8+5;
bool vis[maxn];
int prime[maxn],cnt=0;
int main()
{
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		ll a[5];
		ll cnt=0;
		int flag=0;
		for(int i=2;i<=maxn;i++){
			if(n%i==0){
				n/=i;
				cnt++;
				a[cnt]=i;
			}
			if(i>=n){
				flag=1;
				break;
			}
			if(cnt==2) break;
		}
		//if(n>maxn) flag=1;
		if(flag) cout<<"NO"<<endl;
		else{
			cout<<"YES"<<endl;
			cout<<a[1]<<" "<<a[2]<<" "<<n<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e5;
bool vis[maxn];
int prime[maxn],cnt=0;
int main()
{
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		ll a[5];
		ll cnt=0;
		int flag=0;
		for(int i=2;i<=maxn;i++){
			if(n%i==0){
				n/=i;
				cnt++;
				a[cnt]=i;
			}
			if(i>=n){
				flag=1;
				break;
			}
			if(cnt==2) break;
		}
		if(flag||n>maxn) cout<<"NO"<<endl;
		else{
			cout<<"YES"<<endl;
			cout<<a[1]<<" "<<a[2]<<" "<<n<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e5+5;
bool vis[maxn];
int prime[maxn],cnt=0;
void getprime(int maxn){
     for(int i=2;i<maxn;i++){
         if(!vis[i]) prime[cnt++]=i;
         for(int j=0;j<cnt&&prime[j]*i<maxn ;j++){
             vis[prime[j]*i]=1;
             if(i%prime[j]==0) break;
         }
      }
}
int main()
{
    getprime(maxn);
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		ll a[5];
		ll cnt=0;
		int flag=0;
		for(int i=2;i<=maxn;i++){
			if(n%i==0){
				n/=i;
				cnt++;
				a[cnt]=i;
			}
			if(i>=n){
				flag=1;
				break;
			}
			if(cnt==2) break;
		}
		if(flag) cout<<"NO"<<endl;
		else{
			cout<<"YES"<<endl;
			cout<<a[1]<<" "<<a[2]<<" "<<n<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e5+5;
bool vis[maxn];
int prime[maxn],cnt=0;
int main()
{
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		ll a[5];
		ll cnt=0;
		int flag=0;
		for(int i=2;i<=maxn;i++){
			if(n%i==0){
				n/=i;
				cnt++;
				a[cnt]=i;
			}
			if(i>=n){
				flag=1;
				break;
			}
			if(cnt==2) break;
		}
		if(cnt==0) flag=1;
		if(cnt==1&&n>maxn) flag=1;
		if(flag) cout<<"NO"<<endl;
		else{
			cout<<"YES"<<endl;
			cout<<a[1]<<" "<<a[2]<<" "<<n<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e5+5;
int p[maxn];
int main()
{
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		int cnt=0;
		for(int i=2;i*i<=n;i++){
			while(n%i==0){
				p[++cnt]=i;
				n/=i;
			}
		}
		if(n!=1) p[++cnt]=n;
		int a=1,b=1,c=1;
		for(int i=1;i<=cnt;i++){
			if(a==1) a*=p[i];
			else if(b==1||a==b) b*=p[i];
			else c*=p[i];
		}
		if(a==1||b==1||c==1||a==b||b==c||a==c)printf("NO\n");
		else printf("YES\n%d %d %d\n",a,b,c);
	}
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e5+5;
bool vis[maxn];
int prime[maxn],cnt=0;
int main()
{
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		ll a[5];
		ll cnt=0;
		int flag=0;
		for(int i=2;i<=maxn;i++){
			if(n%i==0){
				n/=i;
				cnt++;
				a[cnt]=i;
			}
			if(i>=n){
				flag=1;
				break;
			}
			if(cnt==2) break;
		}
		if(flag||n>maxn) cout<<"NO"<<endl;
		else{
			cout<<"YES"<<endl;
			cout<<a[1]<<" "<<a[2]<<" "<<n<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a) memset(a,0,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int maxn=1e5+5;
bool vis[maxn];
int prime[maxn],cnt=0;
int main()
{
    int q;cin>>q;
    while(q--){
		ll n;cin>>n;
		ll a[5];
		ll cnt=0;
		int flag=0;
		for(int i=2;i<=maxn;i++){
			if(n%i==0){
				n/=i;
				cnt++;
				a[cnt]=i;
			}
			if(i>=n){
				flag=1;
				break;
			}
			if(cnt==2) break;
		}
		if(cnt==1&&n>maxn) flag=1;
		if(flag) cout<<"NO"<<endl;
		else{
			cout<<"YES"<<endl;
			cout<<a[1]<<" "<<a[2]<<" "<<n<<endl;
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

#define pb              push_back
#define mp              make_pair
#define ll              long long
#define ull             unsigned long long
#define fr(i,a,n)       for (ll i=a;i<n;i++)
#define rf(i,a,n)       for (ll i=n-1;i>=a;i--)
#define tt(x)           ll x; cin>>x; while(x--)
#define t(x)            ll x = 1; while(x--)
#define input(a,n)      for(ll i = 0; i < n; i++){ ll x; cin >> x; a[i] = x;}
#define print(a,n)      for(ll i = 0; i < n; i++){ cout << a[i] << " ";}
#define Print(a)        for(auto it = a.begin() ; it != a.end() ; it++){ cout << *it << " " ;}cout << '\n';
#define ps(x,y)         fixed<<setprecision(y)<<x

const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return (a*b)/__gcd(a,b);}
ll NcR(ll n, ll r) {

    // p holds the value of n*(n-1)*(n-2)...,
    // k holds the value of r*(r-1)...
    long long p = 1, k = 1;

    // C(n, r) == C(n, n-r),
    // choosing the smaller value
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;

            // gcd of p, k
            long long m = __gcd(p, k);

            // dividing by gcd, to simplify product
            // division by their gcd saves from the overflow
            p /= m;
            k /= m;

            n--;
            r--;
        }

        // k should be simplified to 1
        // as C(n, r) is a natural number
        // (denominator should be 1 ) .
    }

    else
        p = 1;

    // if our approach is correct p = ans and k =1
    return p;
}
ll power(ll x ,ll y ){
    if( y == 0 )
    return 1;

    ll temp = power(x,y/2);

    if( y % 2 == 0 )
    return temp*temp;
    else
    return x*temp*temp;
}
ll power(ll x, ll y, ll p) {
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
vector<ll> SieveOfEratosthenes(ll n) {
    bool prime[n+1] = {};

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    vector<ll> v;
    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          v.pb(p);
    return v;
}
ll modInverse(ll n, ll p) {
    return power(n, p-2, p);
}           // Returns n^(-1) mod p
ll nCrModPFermat(ll n, ll r, ll p) {
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
} // Returns nCr % p using Fermat's little theorem
ll fact(ll n) {
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}
bool isPrime(ll num){
    bool flag=true;
    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          flag = false;
          break;
       }
    }
    return flag;
}
void swap(ll &a, ll &b){
    ll temp = b;
    b = a;
    a = temp;
}

void test_case(){
    ll n, a = 0, b = 0, c = 0, i = 2;
    cin >> n;
    if(!isPrime(n)) while(i <= n){
        if(n % i == 0){
            if(a == 0) a = i;
            else if(b == 0) b = i;
            else { c = n; break; }
            n /= i;
        }
        i++;
    }
    if(a and b and c) cout << "YES\n" << a << " " << b << " " << c << endl;
    else cout << "NO\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    tt(x){
        test_case();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define pb              push_back
#define mp              make_pair
#define ll              long long
#define ull             unsigned long long
#define fr(i,a,n)       for (ll i=a;i<n;i++)
#define rf(i,a,n)       for (ll i=n-1;i>=a;i--)
#define tt(x)           ll x; cin>>x; while(x--)
#define t(x)            ll x = 1; while(x--)
#define input(a,n)      for(ll i = 0; i < n; i++){ ll x; cin >> x; a[i] = x;}
#define print(a,n)      for(ll i = 0; i < n; i++){ cout << a[i] << " ";}
#define Print(a)        for(auto it = a.begin() ; it != a.end() ; it++){ cout << *it << " " ;}cout << '\n';
#define ps(x,y)         fixed<<setprecision(y)<<x

const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return (a*b)/__gcd(a,b);}
ll NcR(ll n, ll r) {

    // p holds the value of n*(n-1)*(n-2)...,
    // k holds the value of r*(r-1)...
    long long p = 1, k = 1;

    // C(n, r) == C(n, n-r),
    // choosing the smaller value
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;

            // gcd of p, k
            long long m = __gcd(p, k);

            // dividing by gcd, to simplify product
            // division by their gcd saves from the overflow
            p /= m;
            k /= m;

            n--;
            r--;
        }

        // k should be simplified to 1
        // as C(n, r) is a natural number
        // (denominator should be 1 ) .
    }

    else
        p = 1;

    // if our approach is correct p = ans and k =1
    return p;
}
ll power(ll x ,ll y ){
    if( y == 0 )
    return 1;

    ll temp = power(x,y/2);

    if( y % 2 == 0 )
    return temp*temp;
    else
    return x*temp*temp;
}
ll power(ll x, ll y, ll p) {
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
vector<ll> SieveOfEratosthenes(ll n) {
    bool prime[n+1] = {};

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    vector<ll> v;
    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          v.pb(p);
    return v;
}
ll modInverse(ll n, ll p) {
    return power(n, p-2, p);
}           // Returns n^(-1) mod p
ll nCrModPFermat(ll n, ll r, ll p) {
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
} // Returns nCr % p using Fermat's little theorem
ll fact(ll n) {
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}
bool isPrime(ll num){
    bool flag=true;
    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          flag = false;
          break;
       }
    }
    return flag;
}
void swap(ll &a, ll &b){
    ll temp = b;
    b = a;
    a = temp;
}

void test_case(){
    ll num, a = 0, b = 0, c = 0;
    cin >> num;

    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          a = i;
          break;
       }
    }

    if(a == 0) { cout << "NO\n"; return; }

    for(ll i = sqrt(num/a); i >= 2; i--) {
       if(num/a % i == 0) {
          b = i;
          break;
       }
    }

    c = num/(a*b);
    //cout << a << " " << c << " " << b << endl;

    if(a and b and c and a != c and b != c and c != 1 and a != b) cout << "YES\n" << a << " " << c << " " << b << endl;
    else cout << "NO\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    tt(x){
        test_case();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        vector<ll> v;
        for(ll i = 2; i <= n/2; i++){
            if(n % i == 0) v.push_back(i);
        }

        int flag = 0;
        //cout << v.size();
        if(v.size() >= 3)
        for(ll i = 0; i < v.size() - 2; i++){
            for(ll j = 1; j < v.size() - 1; j++){
                for(ll k = 2; k < v.size(); k++){
                    if(v[i]*v[j]*v[k] == n){
                        cout << "YES\n" << v[i] << " " << v[j] << " " << v[k] << endl;
                        flag = 1;
                        break;
                    }
                    if(flag) break;
                }
                if(flag) break;
            }
            if(flag) break;
        }

        if(flag == 0) cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define pb              push_back
#define mp              make_pair
#define ll              long long
#define ull             unsigned long long
#define fr(i,a,n)       for (ll i=a;i<n;i++)
#define rf(i,a,n)       for (ll i=n-1;i>=a;i--)
#define tt(x)           ll x; cin>>x; while(x--)
#define t(x)            ll x = 1; while(x--)
#define input(a,n)      for(ll i = 0; i < n; i++){ ll x; cin >> x; a[i] = x;}
#define print(a,n)      for(ll i = 0; i < n; i++){ cout << a[i] << " ";}
#define Print(a)        for(auto it = a.begin() ; it != a.end() ; it++){ cout << *it << " " ;}cout << '\n';
#define ps(x,y)         fixed<<setprecision(y)<<x

const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return (a*b)/__gcd(a,b);}
ll NcR(ll n, ll r) {

    // p holds the value of n*(n-1)*(n-2)...,
    // k holds the value of r*(r-1)...
    long long p = 1, k = 1;

    // C(n, r) == C(n, n-r),
    // choosing the smaller value
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;

            // gcd of p, k
            long long m = __gcd(p, k);

            // dividing by gcd, to simplify product
            // division by their gcd saves from the overflow
            p /= m;
            k /= m;

            n--;
            r--;
        }

        // k should be simplified to 1
        // as C(n, r) is a natural number
        // (denominator should be 1 ) .
    }

    else
        p = 1;

    // if our approach is correct p = ans and k =1
    return p;
}
ll power(ll x ,ll y ){
    if( y == 0 )
    return 1;

    ll temp = power(x,y/2);

    if( y % 2 == 0 )
    return temp*temp;
    else
    return x*temp*temp;
}
ll power(ll x, ll y, ll p) {
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
vector<ll> SieveOfEratosthenes(ll n) {
    bool prime[n+1] = {};

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    vector<ll> v;
    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          v.pb(p);
    return v;
}
ll modInverse(ll n, ll p) {
    return power(n, p-2, p);
}           // Returns n^(-1) mod p
ll nCrModPFermat(ll n, ll r, ll p) {
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
} // Returns nCr % p using Fermat's little theorem
ll fact(ll n) {
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}
bool isPrime(ll num){
    bool flag=true;
    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          flag = false;
          break;
       }
    }
    return flag;
}
void swap(ll &a, ll &b){
    ll temp = b;
    b = a;
    a = temp;
}

void test_case(){
    ll num, a = 0, b = 0, c = 0;
    cin >> num;

    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          a = i;
          break;
       }
    }

    for(ll i = sqrt(num); i >= 2; i--) {
       if(num % i == 0) {
          b = i;
          break;
       }
    }

    c = num/(a*b);
    //cout << a << " " << c << " " << b << endl;

    if(a and b and c and a != c and b != c and c != 1 and a != b) cout << "YES\n" << a << " " << c << " " << b << endl;
    else cout << "NO\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    tt(x){
        test_case();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        vector<ll> v;
        for(ll i = 2; i <= n/2; i++){
            if(n % i == 0) v.push_back(i);
        }

        int flag = 0;
        for(ll i = 0; i < v.size(); i++){
            for(ll j = 1; j < v.size(); j++){
                for(ll k = 2; k < v.size(); k++){
                    if(v[i]*v[j]*v[k] == n){
                        cout << "YES\n" << v[i] << " " << v[j] << " " << v[k] << endl;
                        flag = 1;
                        break;
                    }
                    if(flag) break;
                }
                if(flag) break;
            }
        }
        if(flag == 0) cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define pb              push_back
#define mp              make_pair
#define ll              long long
#define ull             unsigned long long
#define fr(i,a,n)       for (ll i=a;i<n;i++)
#define rf(i,a,n)       for (ll i=n-1;i>=a;i--)
#define tt(x)           ll x; cin>>x; while(x--)
#define t(x)            ll x = 1; while(x--)
#define input(a,n)      for(ll i = 0; i < n; i++){ ll x; cin >> x; a[i] = x;}
#define print(a,n)      for(ll i = 0; i < n; i++){ cout << a[i] << " ";}
#define Print(a)        for(auto it = a.begin() ; it != a.end() ; it++){ cout << *it << " " ;}cout << '\n';
#define ps(x,y)         fixed<<setprecision(y)<<x

const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return (a*b)/__gcd(a,b);}
ll NcR(ll n, ll r) {

    // p holds the value of n*(n-1)*(n-2)...,
    // k holds the value of r*(r-1)...
    long long p = 1, k = 1;

    // C(n, r) == C(n, n-r),
    // choosing the smaller value
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;

            // gcd of p, k
            long long m = __gcd(p, k);

            // dividing by gcd, to simplify product
            // division by their gcd saves from the overflow
            p /= m;
            k /= m;

            n--;
            r--;
        }

        // k should be simplified to 1
        // as C(n, r) is a natural number
        // (denominator should be 1 ) .
    }

    else
        p = 1;

    // if our approach is correct p = ans and k =1
    return p;
}
ll power(ll x ,ll y ){
    if( y == 0 )
    return 1;

    ll temp = power(x,y/2);

    if( y % 2 == 0 )
    return temp*temp;
    else
    return x*temp*temp;
}
ll power(ll x, ll y, ll p) {
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
vector<ll> SieveOfEratosthenes(ll n) {
    bool prime[n+1] = {};

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    vector<ll> v;
    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          v.pb(p);
    return v;
}
ll modInverse(ll n, ll p) {
    return power(n, p-2, p);
}           // Returns n^(-1) mod p
ll nCrModPFermat(ll n, ll r, ll p) {
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
} // Returns nCr % p using Fermat's little theorem
ll fact(ll n) {
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}
bool isPrime(ll num){
    bool flag=true;
    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          flag = false;
          break;
       }
    }
    return flag;
}
void swap(ll &a, ll &b){
    ll temp = b;
    b = a;
    a = temp;
}

void test_case(){
    ll num, a = 0, b = 0, c = 0;
    cin >> num;

    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          a = i;
          break;
       }
    }

    if(a == 0) { cout << "NO\n"; return; }

    for(ll i = a + 1; i <= sqrt(num/a); i++) {
       if(num/a % i == 0) {
          b = i;
          break;
       }
    }

    c = num/(a*b);
    //cout << a << " " << c << " " << b << endl;

    if(a and b and c and a != c and b != c and c != 1 and a != b) cout << "YES\n" << a << " " << b << " " << c << endl;
    else cout << "NO\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    tt(x){
        test_case();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define pb              push_back
#define mp              make_pair
#define ll              long long
#define ull             unsigned long long
#define fr(i,a,n)       for (ll i=a;i<n;i++)
#define rf(i,a,n)       for (ll i=n-1;i>=a;i--)
#define tt(x)           ll x; cin>>x; while(x--)
#define t(x)            ll x = 1; while(x--)
#define input(a,n)      for(ll i = 0; i < n; i++){ ll x; cin >> x; a[i] = x;}
#define print(a,n)      for(ll i = 0; i < n; i++){ cout << a[i] << " ";}
#define Print(a)        for(auto it = a.begin() ; it != a.end() ; it++){ cout << *it << " " ;}cout << '\n';
#define ps(x,y)         fixed<<setprecision(y)<<x

const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return (a*b)/__gcd(a,b);}
ll NcR(ll n, ll r) {

    // p holds the value of n*(n-1)*(n-2)...,
    // k holds the value of r*(r-1)...
    long long p = 1, k = 1;

    // C(n, r) == C(n, n-r),
    // choosing the smaller value
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;

            // gcd of p, k
            long long m = __gcd(p, k);

            // dividing by gcd, to simplify product
            // division by their gcd saves from the overflow
            p /= m;
            k /= m;

            n--;
            r--;
        }

        // k should be simplified to 1
        // as C(n, r) is a natural number
        // (denominator should be 1 ) .
    }

    else
        p = 1;

    // if our approach is correct p = ans and k =1
    return p;
}
ll power(ll x ,ll y ){
    if( y == 0 )
    return 1;

    ll temp = power(x,y/2);

    if( y % 2 == 0 )
    return temp*temp;
    else
    return x*temp*temp;
}
ll power(ll x, ll y, ll p) {
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
void SieveOfEratosthenes(ll n) {
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}
ll modInverse(ll n, ll p) {
    return power(n, p-2, p);
}           // Returns n^(-1) mod p
ll nCrModPFermat(ll n, ll r, ll p) {
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
} // Returns nCr % p using Fermat's little theorem
ll fact(ll n) {
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}
bool isPrime(ll num){
    bool flag=true;
    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          flag = false;
          break;
       }
    }
    return flag;
}
void swap(ll &a, ll &b){
    ll temp = b;
    b = a;
    a = temp;
}

void test_case(){
    ll n, a = 0, b = 0, c = 0, i = 2;
    cin >> n;
    while(i <= n){
        if(n % i == 0){
            if(a == 0) a = i;
            else if(b == 0) b = i;
            else { c = n; break; }
            n /= i;
        }
        i++;
    }
    if(a and b and c) cout << "YES\n" << a << " " << b << " " << c << endl;
    else cout << "NO\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    tt(x){
        test_case();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        vector<ll> v;
        for(ll i = 2; i <= n/2; i++){
            if(n % i == 0) v.push_back(i);
        }

        int flag = 0;
        if(v.size() >= 3)
        for(ll i = 0; i < v.size() - 2; i++){
            for(ll j = 1; j < v.size() - 1; j++){
                for(ll k = 2; k < v.size(); k++){
                    if(v[i]*v[j]*v[k] == n){
                        cout << "YES\n" << v[i] << " " << v[j] << " " << v[k] << endl;
                        flag = 1;
                        break;
                    }
                    if(flag) break;
                }
                if(flag) break;
            }
        }
        if(flag == 0) cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define pb              push_back
#define mp              make_pair
#define ll              long long
#define ull             unsigned long long
#define fr(i,a,n)       for (ll i=a;i<n;i++)
#define rf(i,a,n)       for (ll i=n-1;i>=a;i--)
#define tt(x)           ll x; cin>>x; while(x--)
#define t(x)            ll x = 1; while(x--)
#define input(a,n)      for(ll i = 0; i < n; i++){ ll x; cin >> x; a[i] = x;}
#define print(a,n)      for(ll i = 0; i < n; i++){ cout << a[i] << " ";}
#define Print(a)        for(auto it = a.begin() ; it != a.end() ; it++){ cout << *it << " " ;}cout << '\n';
#define ps(x,y)         fixed<<setprecision(y)<<x

const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return (a*b)/__gcd(a,b);}
ll NcR(ll n, ll r) {

    // p holds the value of n*(n-1)*(n-2)...,
    // k holds the value of r*(r-1)...
    long long p = 1, k = 1;

    // C(n, r) == C(n, n-r),
    // choosing the smaller value
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;

            // gcd of p, k
            long long m = __gcd(p, k);

            // dividing by gcd, to simplify product
            // division by their gcd saves from the overflow
            p /= m;
            k /= m;

            n--;
            r--;
        }

        // k should be simplified to 1
        // as C(n, r) is a natural number
        // (denominator should be 1 ) .
    }

    else
        p = 1;

    // if our approach is correct p = ans and k =1
    return p;
}
ll power(ll x ,ll y ){
    if( y == 0 )
    return 1;

    ll temp = power(x,y/2);

    if( y % 2 == 0 )
    return temp*temp;
    else
    return x*temp*temp;
}
ll power(ll x, ll y, ll p) {
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
vector<ll> SieveOfEratosthenes(ll n) {
    bool prime[n+1] = {};

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    vector<ll> v;
    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          v.pb(p);
    return v;
}
ll modInverse(ll n, ll p) {
    return power(n, p-2, p);
}           // Returns n^(-1) mod p
ll nCrModPFermat(ll n, ll r, ll p) {
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
} // Returns nCr % p using Fermat's little theorem
ll fact(ll n) {
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}
bool isPrime(ll num){
    bool flag=true;
    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          flag = false;
          break;
       }
    }
    return flag;
}
void swap(ll &a, ll &b){
    ll temp = b;
    b = a;
    a = temp;
}

void test_case(){
    ll num, a = 0, b = 0, c = 0;
    cin >> num;

    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          a = i;
          break;
       }
    }

    if(a == 0) { cout << "NO\n"; return; }

    for(ll i = sqrt(num/a) - 1; i >= 2; i--) {
       if(num/a % i == 0) {
          b = i;
          break;
       }
    }

    c = num/(a*b);
    //cout << a << " " << c << " " << b << endl;

    if(a and b and c and a != c and b != c and c != 1 and a != b) cout << "YES\n" << a << " " << c << " " << b << endl;
    else cout << "NO\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    tt(x){
        test_case();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        vector<ll> v;
        for(ll i = 2; i <= n/2; i++){
            if(n % i == 0) v.push_back(i);
        }

        int flag = 0;
        for(ll i = 0; i < v.size() - 2; i++){
            for(ll j = 1; j < v.size() - 1; j++){
                for(ll k = 2; k < v.size(); k++){
                    if(v[i]*v[j]*v[k] == n){
                        cout << "YES\n" << v[i] << " " << v[j] << " " << v[k] << endl;
                        flag = 1;
                        break;
                    }
                    if(flag) break;
                }
                if(flag) break;
            }
        }
        if(flag == 0) cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define pb              push_back
#define mp              make_pair
#define ll              long long
#define ull             unsigned long long
#define fr(i,a,n)       for (ll i=a;i<n;i++)
#define rf(i,a,n)       for (ll i=n-1;i>=a;i--)
#define tt(x)           ll x; cin>>x; while(x--)
#define t(x)            ll x = 1; while(x--)
#define input(a,n)      for(ll i = 0; i < n; i++){ ll x; cin >> x; a[i] = x;}
#define print(a,n)      for(ll i = 0; i < n; i++){ cout << a[i] << " ";}
#define Print(a)        for(auto it = a.begin() ; it != a.end() ; it++){ cout << *it << " " ;}cout << '\n';
#define ps(x,y)         fixed<<setprecision(y)<<x

const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return (a*b)/__gcd(a,b);}
ll NcR(ll n, ll r) {

    // p holds the value of n*(n-1)*(n-2)...,
    // k holds the value of r*(r-1)...
    long long p = 1, k = 1;

    // C(n, r) == C(n, n-r),
    // choosing the smaller value
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;

            // gcd of p, k
            long long m = __gcd(p, k);

            // dividing by gcd, to simplify product
            // division by their gcd saves from the overflow
            p /= m;
            k /= m;

            n--;
            r--;
        }

        // k should be simplified to 1
        // as C(n, r) is a natural number
        // (denominator should be 1 ) .
    }

    else
        p = 1;

    // if our approach is correct p = ans and k =1
    return p;
}
ll power(ll x ,ll y ){
    if( y == 0 )
    return 1;

    ll temp = power(x,y/2);

    if( y % 2 == 0 )
    return temp*temp;
    else
    return x*temp*temp;
}
ll power(ll x, ll y, ll p) {
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
vector<ll> SieveOfEratosthenes(ll n) {
    bool prime[n+1] = {};

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    vector<ll> v;
    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          v.pb(p);
    return v;
}
ll modInverse(ll n, ll p) {
    return power(n, p-2, p);
}           // Returns n^(-1) mod p
ll nCrModPFermat(ll n, ll r, ll p) {
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
} // Returns nCr % p using Fermat's little theorem
ll fact(ll n) {
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}
bool isPrime(ll num){
    bool flag=true;
    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          flag = false;
          break;
       }
    }
    return flag;
}
void swap(ll &a, ll &b){
    ll temp = b;
    b = a;
    a = temp;
}

void test_case(){
    ll num, a = 0, b = 0, c = 0;
    cin >> num;

    for(ll i = 2; i <= sqrt(num); i++) {
       if(num % i == 0) {
          a = i;
          break;
       }
    }

    if(a == 0) { cout << "NO\n"; return; }

    for(ll i = 2; i <= sqrt(num/a); i++) {
       if(num % i == 0 and i != a) {
          b = i;
          break;
       }
    }

    c = num/(a*b);
    //cout << a << " " << c << " " << b << endl;

    if(a and b and c and a != c and b != c and c != 1 and a != b) cout << "YES\n" << a << " " << c << " " << b << endl;
    else cout << "NO\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    tt(x){
        test_case();
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
int main(){

    #ifndef ONLINE_JUDGEr
    freopen("input1.txt", "r",stdin);
    freopen("output1.txt", "w",stdout);
    #endif
   int t;
   cin>>t;
   while(t--){
   	int n,a=0,b=0,c=0,q=0;
   	cin>>n;
   	for(a=2;a<=n;a++){
   		if(n%a==0){
   			n/=a;
   			cout<<a<<endl;
   			for(b=a+1;b<=n;b++){
   				if(n%b==0){
   					c=n/b;
   					q=1;
   					break;
					}
   			}
   			if(q)
   				break;
   		}
   	}
   	if(b>=2&&c>=2&&a!=b&&b!=c&&c!=a){
   	cout<<"YES"<<endl;
   	cout<<a<<" "<<b<<" "<<c<<endl;}
   	else
   		cout<<"NO"<<endl;
   }
 return(0);
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
    int n,q=0,a,b,c,d;
    cin>>n;
    d=n;
    for(int i=2;i<n;i++){
    	if(n%i==0){
    		a=i;
    		n=n/a;
    		for(int j=2;j<n;j++){
    			if(n%j==0){
    				b=j;
    				n=n/b;
    				break;
				}
			}
		}
	}
	if(d%(a*b)==0){
		c=d/(a*b);
		if(c>=2)
		q=1;
	}
	if(q){
	cout<<"YES"<<endl;
	cout<<a<<" "<<b<<" "<<c<<endl;
	}
	else
	cout<<"NO"<<endl;
	}
    return(0);
    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
    int n,q=0,a,b,c,d;
    cin>>n;
    d=n;
    for(int i=2;i<=n;i++){
    	if(n%i==0){
    		a=i;
    		n=n/a;
    		for(int j=2;j<=n;j++){
    			if(n%j==0){
    				b=j;
    				n=n/b;
    				break;
				}
			}
		}
	}
	if(d%(a*b)==0){
		c=d/(a*b);
		if(c>=2&&a!=b&&b!=c&&c!=a)
		q=1;
	}
	if(q){
	cout<<"YES"<<endl;
	cout<<a<<" "<<b<<" "<<c<<endl;
	}
	else
	cout<<"NO"<<endl;
	}
    return(0);
    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
    int n,q=0,a,b,c,d,t=0;
    cin>>n;
    d=n;
    for(int i=2;i<=n;i++){
    	if(n%i==0){
    		a=i;
    		n=n/a;
    		for(int j=2;j<=n;j++){
    			if(n%j==0){
    				b=j;
    				n=n/b;
    				t=1;
    				break;
				}
			}
		}
		if(t)
		break;
	}
	if(d%(a*b)==0){
		c=d/(a*b);
		if(c>=2&&a!=b&&b!=c&&c!=a)
		q=1;
	}
	if(q){
	cout<<"YES"<<endl;
	cout<<a<<" "<<b<<" "<<c<<endl;
	}
	else
	cout<<"NO"<<endl;
	}
    return(0);
    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
    int n,q=0,a,b,c,d;
    cin>>n;
    d=n;
    for(int i=2;i<n;i++){
    	if(n%i==0){
    		a=i;
    		n=n/a;
    		for(int j=2;j<n;j++){
    			if(n%j==0){
    				b=j;
    				n=n/b;
    				break;
				}
			}
		}
	}
	if(d%(a*b)==0){
		c=d/(a*b);
		if(c>=2&&a!=b&&b!=c&&c!=a)
		q=1;
	}
	if(q){
	cout<<"YES"<<endl;
	cout<<a<<" "<<b<<" "<<c<<endl;
	}
	else
	cout<<"NO"<<endl;
	}
    return(0);
    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
    int n,q=0,a,b,c,d;
    cin>>n;
    d=n;
    for(int i=2;i<=n;i++){
    	if(n%i==0){
    		a=i;
    		n=n/a;
    		for(int j=2;j<=n;j++){
    			if(n%j==0){
    				b=j;
    				break;
				}
			}
		}
	}
	if(d%(a*b)==0){
		c=d/(a*b);
		if(c>=2&&a!=b&&b!=c&&c!=a)
		q=1;
	}
	if(q){
	cout<<"YES"<<endl;
	cout<<a<<" "<<b<<" "<<c<<endl;
	}
	else
	cout<<"NO"<<endl;
	}
    return(0);
    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
    int n,q=0,a,b,c,d;
    cin>>n;
    d=n;
    for(int i=2;i<n;i++){
    	if(n%i==0){
    		a=i;
    		n=n/a;
    		for(int j=2;j<n;j++){
    			if(n%j==0){
    				b=j;
    				n=n/b;
    				if(d%(a*b)==0){
    					q=1;
    					c=d/(a*b);
    					break;
					}
					else{
						break;
					}
				}
			}
		}
	}
	if(q){
	cout<<"YES"<<endl;
	cout<<a<<" "<<b<<" "<<c<<endl;
	}
	else
	cout<<"NO"<<endl;
	}
    return(0);
    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
    int n,q=0,a,b,c,d;
    cin>>n;
    d=n;
    for(int i=2;i<n;i++){
    	if(n%i==0){
    		a=i;
    		n=n/a;
    		for(int j=a;j<n;j++){
    			if(n%j==0){
    				b=j;
    				n=n/b;
    				break;
				}
			}
		}
	}
	if(d%(a*b)==0){
		c=d/(a*b);
		if(c>=2&&a!=b&&b!=c&&c!=a)
		q=1;
	}
	if(q){
	cout<<"YES"<<endl;
	cout<<a<<" "<<b<<" "<<c<<endl;
	}
	else
	cout<<"NO"<<endl;
	}
    return(0);
    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
	int t;
    cin>>t;
    while(t--){
   	int n,a=0,b=0,c=0,q=0;
   	cin>>n;
   	for(a=2;a<=n;a++){
   		if(n%a==0){
   			n/=a;
   			for(b=a+1;b<=n;b++){
   				if(n%b==0){
   					c=n/b;
   					q=1;
   					break;
					}
   			}
   			if(q)
   				break;
   		}
   	}
   	if(b!=c&&c!=a&&c>=2){
   	cout<<"YES"<<endl;
   	cout<<a<<" "<<b<<" "<<c<<endl;}
   	else
   		cout<<"NO"<<endl;
   }
   return(0);

    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
	int t;
    cin>>t;
    while(t--){
   	int n,a=0,b=0,c=0,q=0;
   	cin>>n;
   	for(a=2;a<sqrt(n);a++){
   		if(n%a==0){
   			n/=a;
   			for(b=a+1;b<sqrt(n);b++){
   				if(n%b==0){
   					c=n/b;
   					q=1;
   					break;
					}
   			}
   			if(q)
   				break;
   		}
   	}
   	if(b!=c&&c!=a&&c>=2){
   	cout<<"YES"<<endl;
   	cout<<a<<" "<<b<<" "<<c<<endl;}
   	else
   		cout<<"NO"<<endl;
   }
   return(0);

    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
	int t;
    cin>>t;
    while(t--){
   	int n,a=0,b=0,c=0,q=0;
   	cin>>n;
   	for(a=2;a<=n;a++){
   		if(n%a==0){
   			n/=a;
   			for(b=a+1;b<=n;b++){
   				if(n%b==0){
   					c=n/b;
   					q=1;
   					break;
					}
   			}
   			if(q)
   				break;
   		}
   	}
   	if(a!=b&&b!=c&&c!=a){
   	cout<<"YES"<<endl;
   	cout<<a<<" "<<b<<" "<<c<<endl;}
   	else
   		cout<<"NO"<<endl;
   }
   return(0);

    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int main(){
	int t;
    cin>>t;
    while(t--){
   	int n,a=0,b=0,c=0,q=0;
   	cin>>n;
   	for(a=2;a<=n;a++){
   		if(n%a==0){
   			n/=a;
   			for(b=a+1;b<=n;b++){
   				if(n%b==0){
   					c=n/b;
   					q=1;
   					break;
					}
   			}
   			if(q)
   				break;
   		}
   	}
   	if(b>=2&&c>=2&&a!=b&&b!=c&&c!=a){
   	cout<<"YES"<<endl;
   	cout<<a<<" "<<b<<" "<<c<<endl;}
   	else
   		cout<<"NO"<<endl;
   }
   return(0);

    }


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > fact(int n){
  vector<pair<int,int> > fp;
  for(int i = 2; i <= n; ++i){
    pair<int,int> pp = make_pair(i,0);
    while(!(n%i)){
    	n /= i;
    	pp.second++;
    }
    if(pp.second)
    	fp.push_back(pp);
  }
  if(n > 1)
	  fp.push_back(make_pair(n,1));
  return fp;
}

int main(){
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        vector<pair<int,int> > f;
        f = fact(n);
        if(f.size()>3){
            cout<<"YES"<<endl;
            cout<<pow(f[0].first,f[0].second)<<" "<<pow(f[1].first,f[1].second)<<" ";
            int last= pow(f[2].first,f[2].second);
            for(int i =3;i<f.size();i++)
                last*=pow(f[i].first,f[i].second);
            cout<<last<<endl;
        }
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(auto c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345
→Judgement Protocol
Test: #1, time: 15 ms., memory: 144 KB, exit code: 0, checker exit code: 0, verdict: OK
Input
5
64
32
97
2
12345
Output
YES
2 4 8
NO
NO
NO
YES
3 5 823
Checker Log
ok Ok, 5 test cases, 2 answers YES (5 test cases)
close


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > fact(int n){
  vector<pair<int,int> > fp;
  for(int i = 2; i <= n; ++i){
    pair<int,int> pp = make_pair(i,0);
    while(!(n%i)){
    	n /= i;
    	pp.second++;
    }
    if(pp.second)
    	fp.push_back(pp);
  }
  if(n > 1)
	  fp.push_back(make_pair(n,1));
  return fp;
}

int main(){
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        vector<pair<int,int> > f;
        f = fact(n);
        if(f.size()>3)cout<<"NO"<<endl;
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(auto c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> trial_division2(int n) {
    vector<pair<int,int>>fact;
    int p = -1;
    if(n%2== 0){
        fact.push_back({2,1});
        n/=2;
        p++;
        while (n % 2 == 0) {
            fact[p].second++;
            n /= 2;
        }
    }
    for (long long d = 3; d * d <= n; d += 2) {
        if(n%d == 0){p++;fact.push_back({d,1});n/=d;}
        while (n % d == 0) {
            fact[p].second++;
            n /= d;
        }
    }
    if (n > 1)
        fact.push_back({n,1});
    return fact;
}

int main(){
    ios_base::sync_with_stdio(0);
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        vector<pair<int,int> > f;
        f = trial_division2(n);
        if(f.size()>3){
            cout<<"YES"<<endl;
            cout<<pow(f[0].first,f[0].second)<<" "<<pow(f[1].first,f[1].second)<<" ";
            int last= pow(f[2].first,f[2].second);
            for(int i =3;i<f.size();i++)
                last*=pow(f[i].first,f[i].second);
            cout<<last<<endl;
        }
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(auto c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else if(f[0].second == 2&& f[1].second==2)cout<<"YES"<<endl<<f[0].first<<" "<<f[1].first<<" "<<f[0].first*f[1].first<<endl;
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > fact(int n){
  vector<pair<int,int> > fp;
  for(int i = 2; i <= n; ++i){
    pair<int,int> pp = make_pair(i,0);
    while(!(n%i)){
    	n /= i;
    	pp.second++;
    }
    if(pp.second)
    	fp.push_back(pp);
  }
  if(n > 1)
	  fp.push_back(make_pair(n,1));
  return fp;
}

int main(){
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        vector<pair<int,int> > f;
        f = fact(n);
        if(f.size()>3){
            cout<<"YES"<<endl;
            cout<<pow(f[0].first,f[0].second)<<" "<<pow(f[1].first,f[1].second)<<" ";
            int last= pow(f[2].first,f[2].second);
            for(int i =3;i<f.size();i++)
                last*=pow(f[i].first,f[i].second);
            cout<<last<<endl;
        }
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(auto c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else if(f[0].second == 2&& f[1].second==2)cout<<f[0].first<<" "<<f[1].first<<" "<<f[0].first*f[1].first<<endl;
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> trial_division2(int n) {
    vector<pair<int,int>>fact;
    int p = -1;
    if(n%2== 0){
        fact.push_back({2,1});
        n/=2;
        p++;
        while (n % 2 == 0) {
            fact[p].second++;
            n /= 2;
        }
    }
    for (int d = 3; d * d <= n; d += 2) {
        if(n%d == 0){p++;fact.push_back({d,1});n/=d;}
        while (n % d == 0) {
            fact[p].second++;
            n /= d;
        }
    }
    if (n > 1)
        fact.push_back({n,1});
    return fact;
}

int main(){
    ios_base::sync_with_stdio(0);
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        cout<<fixed<<setprecision(0);
        vector<pair<int,int> > f;
        f = trial_division2(n);
        if(f.size()>3){
            cout<<"YES"<<endl;
            cout<<pow(f[0].first,f[0].second)<<" "<<pow(f[1].first,f[1].second)<<" ";
            int last= pow(f[2].first,f[2].second);
            for(int i =3;i<f.size();i++)
                last*=pow(f[i].first,f[i].second);
            cout<<last<<endl;
        }
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(pair<int,int> c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else if(f[0].second == 2&& f[1].second==2)cout<<"YES"<<endl<<f[0].first<<" "<<f[1].first<<" "<<f[0].first*f[1].first<<endl;
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > fact(int n){
  vector<pair<int,int> > fp;
  for(int i = 2; i <= n; ++i){
    pair<int,int> pp = make_pair(i,0);
    while(!(n%i)){
    	n /= i;
    	pp.second++;
    }
    if(pp.second)
    	fp.push_back(pp);
  }
  if(n > 1)
	  fp.push_back(make_pair(n,1));
  return fp;
}

int main(){
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        vector<pair<int,int> > f;
        f = fact(n);
        if(f.size()>3){
            cout<<"YES"<<endl;
            cout<<pow(f[0].first,f[0].second)<<" "<<pow(f[1].first,f[1].second)<<" ";
            int last= pow(f[2].first,f[2].second);
            for(int i =3;i<f.size();i++)
                last*=pow(f[i].first,f[i].second);
            cout<<last<<endl;
        }
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(auto c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > fact(int n){
  vector<pair<int,int> > fp;
  for(int i = 2; i <= n; ++i){
    pair<int,int> pp = make_pair(i,0);
    while(!(n%i)){
    	n /= i;
    	pp.second++;
    }
    if(pp.second)
    	fp.push_back(pp);
  }
  if(n > 1)
	  fp.push_back(make_pair(n,1));
  return fp;
}

int main(){
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        vector<pair<int,int> > f;
        f = fact(n);
        if(f.size()>3){
            cout<<pow(f[0].first,f[0].second)<<" "<<pow(f[1].first,f[1].second)<<" ";
            int last= pow(f[2].first,f[2].second);
            for(int i =3;i<f.size();i++)
                last*=pow(f[i].first,f[i].second);
            cout<<last<<endl;
        }
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(auto c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > fact(int n){
  vector<pair<int,int> > fp;
  for(int i = 2; i <= n; ++i){
    pair<int,int> pp = make_pair(i,0);
    while(!(n%i)){
    	n /= i;
    	pp.second++;
    }
    if(pp.second)
    	fp.push_back(pp);
  }
  if(n > 1)
	  fp.push_back(make_pair(n,1));
  return fp;
}

int main(){
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        vector<pair<int,int> > f;
        f = fact(n);
        if(f.size()>3){
            cout<<pow(f[0].first,f[0].second)<<" "<<pow(f[1].first,f[1].second)<<" ";
            int last= pow(f[2].first,f[2].second);
            for(int i =3;i<f.size();i++)
                last*=pow(f[i].first,f[i].second);
            cout<<last<<endl;
        }
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(auto c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else if(f[0].second == 2&& f[1].second==2)cout<<f[0].first<<" "<<f[1].first<<" "<<f[0].first*f[1].first<<endl;
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > fact(int n){
  vector<pair<int,int> > fp;
  for(int i = 2; i <= n; ++i){
    pair<int,int> pp = make_pair(i,0);
    while(!(n%i)){
    	n /= i;
    	pp.second++;
    }
    if(pp.second)
    	fp.push_back(pp);
  }
  if(n > 1)
	  fp.push_back(make_pair(n,1));
  return fp;
}

int main(){
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        vector<pair<int,int> > f;
        f = fact(n);
        if(f.size()>3)cout<<"NO"<<endl;
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(auto c:f)cout<<pow(c.first,c.second)<<" ";
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345


#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> trial_division2(int n) {
    vector<pair<int,int>>fact;
    int p = -1;
    if(n%2== 0){
        fact.push_back({2,1});
        n/=2;
        p++;
        while (n % 2 == 0) {
            fact[p].second++;
            n /= 2;
        }
    }
    for (int d = 3; d * d <= n; d += 2) {
        if(n%d == 0){p++;fact.push_back({d,1});n/=d;}
        while (n % d == 0) {
            fact[p].second++;
            n /= d;
        }
    }
    if (n > 1)
        fact.push_back({n,1});
    return fact;
}

int main(){
    ios_base::sync_with_stdio(0);
    int t,n;
    cin>>t;
    while(t--){
        cin>>n;
        cout<<fixed<<setprecision(0);
        vector<pair<int,int> > f;
        f = trial_division2(n);
        for(auto c:f)cout<<c.first<<" "<<c.second<<endl;
        if(f.size()>3){
            cout<<"YES"<<endl;
            cout<<pow(f[0].first,f[0].second)<<" "<<pow(f[1].first,f[1].second)<<" ";
            int last= pow(f[2].first,f[2].second);
            for(int i =3;i<f.size();i++)
                last*=pow(f[i].first,f[i].second);
            cout<<last<<endl;
        }
        else if(f.size()==3){
            cout<<"YES"<<endl;
            for(pair<int,int> c:f)cout<<pow(c.first,c.second)<<" ";
            cout<<endl;
        }
        else if(f.size()==2){
            if(f[0].second>2||f[1].second>2){
                cout<<"YES"<<endl;
                if(f[0].second>2)cout<<f[0].first<<" "<<pow(f[0].first,f[0].second-1)<<" "<<pow(f[1].first,f[1].second)<<endl;
                else cout<<f[1].first<<" "<<pow(f[1].first,f[1].second-1)<<" "<<pow(f[0].first,f[0].second)<<endl;
            }
            else if(f[0].second == 2&& f[1].second==2)cout<<"YES"<<endl<<f[0].first<<" "<<f[1].first<<" "<<f[0].first*f[1].first<<endl;
            else cout<<"NO"<<endl;
        }
        else if(f.size()==1){
            if(f[0].second>=6){

                cout<<"YES"<<endl;
                cout<<f[0].first<<" "<<pow(f[0].first,2)<<" "<<pow(f[0].first,f[0].second-3)<<endl;
            }
            else cout<<"NO"<<endl;
        }
    }
}
// 5
// 64
// 32
// 97
// 2
// 12345