#include<iostream>
#include<queue>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<map>
#include<cstdlib>
#include<cmath>
#include<vector>
#define LL long long
#define IT __int64
#define zero(x) fabs(x)<eps
#define mm(a,b) memset(a,b,sizeof(a))
const int INF=0x7fffffff;
const double inf=1e8;
const double eps=1e-10;
const double PI=acos(-1.0);
const int Max=3001;
using namespace std;
char a[Max];
char b[Max];
int main()
{
    scanf("%s",a);
    scanf("%s",b);
    int n = strlen(a);
    int m = strlen(b);

    int ans = n+m;
    //��߼����ɸ�
    for (int i=0; i<=m; i++)
    {
        int tmp = i;
        int k;
        for (k = 0; k<n && i+k<m; k++)
        {
            if (a[k] == b[i+k])
                continue;
            else
                tmp++;
        }
        if (k+i<m)
        {
            tmp += (m-k-i);
        }
        if (tmp < ans)
            ans = tmp;
    }
    //�����ȥ���ɸ�
    for (int i=0; i<=n; i++)
    {
        int tmp = 0;
        int k;
        for (k=0; k<m && k+i<n; k++)
        {
            if (b[k] == a[i + k])
                continue;
            else
                tmp++;
        }
        if (k < m)
        {
            tmp += (m - k);
        }

        if (tmp < ans)
            ans = tmp;
    }
    printf("%d\n",ans);
    return 0;
}


#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;
string a;
string b;
int main()
{
    cin>>a>>b;

    int len1=a.length();
    int len2=b.length();
    int ans=10000000;
    int len=len2;
    if(len1<len2)
       {
          swap(a,b);
          swap(len1,len2);
       }

    for(int i=0;i<len2;i++)
    {
           int num=0;
        for(int k=i,j=0;k<len2&&j<len1;k++,j++)
        {
           if(b[k]==a[j])
            num++;
        }
        ans=min(ans,len-num);
    }

    for(int i=0;i<len1;i++)
    {
        int num=0;
        for(int k=i,j=0;j<len2&&k<len1;j++,k++)
        {
            if(a[k]==b[j])
                num++;
        }

        ans=min(ans,len-num);
    }
    printf("%d\n",ans);

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int main()
{
    int d[3020][3020];
    string a,b;
    while(cin>>a>>b)
    {
        memset(d,0,sizeof(d));
        int i,j;
        int x,y;
        x=strlen(&a[0]);
        y=strlen(&b[0]);
        for(i=1;i<=x;i++)
        {
            for(j=1;j<=y;j++)
            {
                if(a[i-1]==b[j-1]) d[i][j]=d[i-1][j-1]+1;
                else d[i][j]=max(d[i-1][j],d[i][j-1]);
            }
        }
        cout<<y-d[x][y]<<endl;
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int maxsum;
int d[3005][3005];
int main()
{

    string a,b;
    while(cin>>a>>b)
    {
        maxsum=0;
        memset(d,0,sizeof(d));
        int i,j;
        int x,y;
        x=strlen(&a[0]);
        y=strlen(&b[0]);
        for(i=1;i<=x;i++)
        {
            for(j=1;j<=y;j++)
            {
                if(a[i-1]==b[j-1]) d[i][j]=d[i-1][j-1]+1;
                if(d[i][j]>maxsum) maxsum=d[i][j];
            }
        }
        memset(d,0,sizeof(d));
        for(i=1;i<=y;i++)
        {
            for(j=1;j<=x;j++)
            {
                if(b[i-1]==a[j-1]) d[i][j]=d[i-1][j-1]+1;
                if(d[i][j]>maxsum) maxsum=d[i][j];
            }
        }
        y=y-maxsum;
        cout<<y<<endl;
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int maxsum;
int main()
{
    int d[2005][2005];
    string a,b;
    while(cin>>a>>b)
    {
        maxsum=0;
        memset(d,0,sizeof(d));
        int i,j;
        int x,y;
        x=strlen(&a[0]);
        y=strlen(&b[0]);
        for(i=1;i<=x;i++)
        {
            for(j=1;j<=y;j++)
            {
                if(a[i-1]==b[j-1]) d[i][j]=d[i-1][j-1]+1;
                if(d[i][j]>maxsum) maxsum=d[i][j];

            }
        }
        y=y-maxsum;
        cout<<y<<endl;
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int maxsum;
int main()
{
    int d[205][205];
    string a,b;
    while(cin>>a>>b)
    {
        maxsum=0;
        memset(d,0,sizeof(d));
        int i,j;
        int x,y;
        x=strlen(&a[0]);
        y=strlen(&b[0]);
        for(i=1;i<=x;i++)
        {
            for(j=1;j<=y;j++)
            {
                if(a[i-1]==b[j-1]) d[i][j]=d[i-1][j-1]+1;
                if(d[i][j]>maxsum) maxsum=d[i][j];

            }
        }
        y=y-maxsum;
        cout<<y<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fs first
#define se second
#define mp make_pair
#define pb push_back
#define precise(n,k) fixed<<setprecision(k)<<n
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OST;
typedef long long ll;
typedef long double lf;
string s,t;
ll n,m,ans,cur;
int main() {
	// your code goes here
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>s>>t;
	ans=LLONG_MAX;
	m=(ll)t.length();
	string temp="";
	for(ll i=0;i<m;i++)
	temp+="#";
	s=temp+s+temp;
	n=(ll)s.length();
	for(ll i=0;i+m-1<n;i++)
	{
		cur=0;
		for(ll j=0;j<m;j++)
		{
			if(s[i+j] != t[j])
			cur++;
		}
		ans=min(ans,cur);
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
int n,m,dp[2001][2001];
string a,b;
int calc(int i,int j){
    if(i==n||j==m)return 0;
    int &k=dp[i][j];
    if(k!=-1)return k;
    if(a[i]!=b[j])return 0;
    return k=1+calc(i+1,j+1);
}
int main()
{
    int x=0;
    cin>>a>>b;
    n=a.size();m=b.size();
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            x=max(x,calc(i,j));
    cout<<m-x;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
int n,m,dp[2001][2001];
string a,b;
int calc(int i,int j){
    if(i==n||j==m)return 0;
    int &k=dp[i][j];
    if(k!=-1)return k;
    if(a[i]==b[j])k=1+calc(i+1,j+1);
    else k=calc(i+1,j+1);
    return k;
}
int main()
{
    int x=0;
    cin>>a>>b;
    n=a.size();m=b.size();
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            x=max(x,calc(i,j));
    cout<<m-x;
    return 0;
}


#include <bits/stdc++.h>

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int mem[ 2002 ][ 2002 ] ;
string a , b ;
int solve( int i , int j ){
   if( i == -1 ) {
     return j + 1 ;
   }
   if( j == -1 ) {
     return i + 1 ;
   }

   int & ret = mem[ i ][ j ] ;
   if( ret != -1 ) return ret ;
   ret = 0 ;
   if( a[ i ] == b[ j ] ){
     return ret = solve( i - 1 , j - 1 ) ;
   }

   return ret = 1 + min( min( solve( i , j - 1 ) , solve( i - 1 , j ) ) , solve( i - 1 , j - 1 ) ) ;
}

int main() {
    cin >> a >> b ;
    Clear( mem , -1 ) ;
    int mn = solve( sz( a ) - 1 , sz( b ) - 1 ) ;
    if( sz( a ) > sz( b ) ) mn -= sz( a ) - sz( b ) ;
    cout << mn << "\n" ;

}


#include <bits/stdc++.h>

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int mem[ 2002 ][ 2002 ] ;
string a , b ;
int solve( int i , int j ){
   if( i == -1 ) {
     return j + 1 ;
   }
   if( j == -1 ) {
     return i + 1 ;
   }

   int & ret = mem[ i ][ j ] ;
   if( ret != -1 ) return ret ;
   ret = 0 ;
   if( a[ i ] == b[ j ] ){
     return ret = solve( i - 1 , j - 1 ) ;
   }

   return ret = 1 + min( min( solve( i , j - 1 ) , solve( i - 1 , j ) ) , solve( i - 1 , j - 1 ) ) ;
}

int main() {
    cin >> a >> b ;
    if( sz( a ) > sz( b ) ){
        int mn = Int_max ;
        forn( int , i , 0 , sz( a ) - sz( b ) + 1 ){
           string tmp = "" ;
           forn( int , j , i , i + sz( b ) ) {
               tmp += a[ j ] ;
           }

           int cn = 0 ;
           forn( int , i , 0 , sz( tmp ) ){
             cn += tmp[ i ] != b[ i ] ;
           }
           mn = min( mn , cn ) ;
        }

        cout << mn << "\n" ;

        return 0 ;
    }

    Clear( mem , -1 ) ;
    cout << solve( sz( a ) - 1 , sz( b ) - 1 ) ;

}


#include <bits/stdc++.h>

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int mem[ 2002 ][ 2002 ] ;
string a , b ;
int solve( int i , int j ){
   if( i == -1 ) {
     return j + 1 ;
   }
   if( j == -1 ) {
     return i + 1 ;
   }

   int & ret = mem[ i ][ j ] ;
   if( ret != -1 ) return ret ;
   ret = 0 ;
   if( a[ i ] == b[ j ] ){
     return ret = solve( i - 1 , j - 1 ) ;
   }

   return ret = 1 + min( min( solve( i , j - 1 ) , solve( i - 1 , j ) ) , solve( i - 1 , j - 1 ) ) ;
}

int main() {
    cin >> a >> b ;
    string c = "=" ;
    forn( int , i , 0 , 2002 ) c += "=" ;
    a = c + a + c ;
        int mn = Int_max ;
        forn( int , i , 0 , sz( a ) - sz( b ) + 1 ){
           string tmp = "" ;
           forn( int , j , i , i + sz( b ) ) {
               tmp += a[ j ] ;
           }

           int cn = 0 ;
           forn( int , i , 0 , sz( tmp ) ){
             cn += tmp[ i ] != b[ i ] ;
           }
           mn = min( mn , cn ) ;
        }

        cout << mn << "\n" ;

        return 0 ;

}


/* */
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
const int MAX_LEN = 1010;
#define GETLINE(x) fgets(x,MAX_LEN,stdin);
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<double, double> dd;
typedef tuple<int, int, int> iii;
typedef vector<ii> vii;
typedef vector<ll> vll;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int compx(string a,string b){
	int cnt=0;
	for(int i=0;i<(int)a.length();i++)if(a[i]!=b[i])cnt++;
	return cnt;
}
string s;
string t;
char sx[2010],tx[2010];
int main () {
	scanf("%s",sx);
	scanf("%s",tx);
	int ns=strlen(sx);
	int nt=strlen(tx);
	t=string(tx);
	string temp(nt-1,'X');
	s=temp;
	s+=string(sx);
	s+=temp;
	int ans=1e5;
	for(int i=0;i<ns+nt-1;i++){
		ans=min(ans,compx(s.substr(i,nt),t));
	}
	printf("%d\n",ans);
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Div33 {

	public static void main(String[] args)throws  Exception {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int T=Integer.parseInt(br.readLine());
		for(int t=0;t<T;t++) {
			int N=Integer.parseInt(br.readLine());
			int c=0;
			double m=Math.sqrt(N);
			int [] array=new int[(int)m+2];
			int j=0;
			for(int i=1;i*i<=N;i++) {
				if(N%i==0) {
					c+=1;
					array[j]=i;
					j+=1;
				}
				if(c-1>=3) {
					System.out.println("YES");
					System.out.println(array[1]+" "+array[2]+" "+array[3]);
					break;
				}
			}
			if(c-1<3) {
				System.out.println("NO");
			}
		}
	}

}


import java.io.*;
import java.util.*;

public class ProductOfThreeNumbers {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int T = Integer.parseInt(br.readLine());
		while(T-->0) {
			int N = Integer.parseInt(br.readLine());
			solution(N);
			}
	}

	public static void solution(int N) throws Exception {
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		for(int a=2;a<N;a++) {
			if(N%a==0) {
				int x = N/a;
				for(int b=2;b<x;b++) {
					if(x%b==0 && a!=b) {
						int c = x/b;
						if(c != a && c != b && c!=1) {
							bw.write("YES\n");
							bw.write(a+" "+b+" "+c+"\n");
							bw.flush();
							return;
						}
					}
				}
			}
		}
		bw.write("NO\n");
		bw.flush();
	}

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Div33 {

	public static void main(String[] args)throws  Exception {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int T=Integer.parseInt(br.readLine());
		for(int t=0;t<T;t++) {
			int N=Integer.parseInt(br.readLine());
			int c=0;
			double m=Math.sqrt(N);
			int [] array=new int[(int)m+2];
			int j=0;
			for(int i=1;i*i<=N;i++) {
				if(N%i==0) {
					c+=1;
					array[j]=i;
					j+=1;
				}
				if(c-1>=3) {
					array[3]=N/(array[1]*array[2]);
					System.out.println("YES");
					System.out.println(array[1]+" "+array[2]+" "+array[3]);
					break;
				}
			}
			if(c-1<3) {
				System.out.println("NO");
			}
		}
	}

}


import java.io.*;
import java.util.*;

public class ProductOfThreeNumbers {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int T = Integer.parseInt(br.readLine());
		while(T-->0) {
			int N = Integer.parseInt(br.readLine());
			solution(N);
			}
	}

	public static void solution(int N) throws Exception {
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		for(int c = 2;c<N;c++) {
			int a = 2;
			int b = c-1;
			while(a<b && a!=b) {
				if(a*b*c>N)
					b--;
				else if(a*b*c<N)
					a++;
				else {
					bw.write("YES\n");
					bw.write(a+" "+b+" "+c+"\n");
					bw.flush();
					return;
				}
			}
		}
		bw.write("NO\n");
		bw.flush();
	}

}


import java.io.*;
import java.util.*;

public class ProductOfThreeNumbers {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int T = Integer.parseInt(br.readLine());
		while(T-->0) {
			int N = Integer.parseInt(br.readLine());
			solution(N);
			}
	}

	public static void solution(int N) throws Exception {
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		for(int a=2;a<N;a++) {
			if(N%a == 0) {
				for(int b=2;b<N/a;b++) {
					if((N/a)%b==0 && a!=b) {
						int c = N/(a*b);
						if(c != a && c != b) {
							bw.write("YES\n");
							bw.write(a+" "+b+" "+c+"\n");
							bw.flush();
							return;
						}
					}
				}
			}
		}
		bw.write("NO\n");
		bw.flush();
	}

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Div33 {
	public static void main(String args []) throws Exception{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		long T=Long.parseLong(br.readLine());
		for(int t=0;t<T;t++) {
			long N=Long.parseLong(br.readLine());
			long cnt=0;
			boolean findFactors=false;
			for(long i=2;i*i<=N;i++) {
				if(N%i==0) {
					cnt++;
				}
				if(cnt>=3) {
					findFactors=true;
					System.out.println("YES");
					break;
				}

			}
			if(findFactors) {
				cnt=0;
				long j=2;
				while(cnt<3) {
					if(N%j==0) {
						System.out.print(j+" ");
						N=N/j;
						cnt++;
					}
					j++;

				}
				System.out.println();
			}
			else {
				System.out.println("NO");
			}
		}
	}

}


import java.io.*;
import java.util.*;

public class ProductOfThreeNumbers {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int T = Integer.parseInt(br.readLine());
		while(T-->0) {
			int N = Integer.parseInt(br.readLine());
			solution(N);
			}
	}

	public static void solution(int N) throws Exception {
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		for(int c = N-1;c>=2;c--) {
			int a = 2;
			int b = c-1;
			while(a<b && a!=b) {
				if(a*b*c>N)
					b--;
				else if(a*b*c<N)
					a++;
				else {
					bw.write("YES\n");
					bw.write(a+" "+b+" "+c+"\n");
					bw.flush();
					return;
				}
			}
		}
		bw.write("NO\n");
		bw.flush();
	}

}


import java.util.*;

public class code {
	static int sqrt(int x) {
		for(int i=2; true; i++) {
			if(i*i==x) {
				return i;
			}
			if(i*i>x) {
				return i-1;
			}
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i=0; i<n; i++) {
			int a= sc.nextInt();
			int b= sqrt(a);
			int c=0;
			double[] arr= new double[2];
			for(double j=2; j<=b; j++) {
				if((a/j)%1==0) {
					arr[c]=j;
					c++;
				}
				if(c==2) {
					double z=((a/arr[0])/arr[1]);
					if(z%1==0 && z!=arr[1] && z!=arr[0]) {
						break;
					}
					else {
						c--;
					}
				}
			}
			if(c==2) {
				System.out.println("YES");
				System.out.println((int)arr[0]+" "+(int)arr[1]+" "+(int)((a/arr[0])/arr[1]));
			}
			else {
				System.out.println("NO");
			}
		}
	}
}


import java.util.*;
public class GUC {
	static int cbrt(int g) {
		int k =2;
		while(true) {
			if(k*k*k>=g) {
				break;
			}
			k++;
		}
		return k;
	}

	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();
		int i=0;
		double j =2;
		int c = 0;
		int a = 0;
		int b = 0;
		int[] arr= new int[2];
		while(i<n) {
			a = sc.nextInt();
			b=cbrt(a);
			while(j<=b) {
				if((a/j)%1==0){
					arr[c]=(int)j;
					c++;
				}
				if (c==2) {
					break;
				}
				j++;
			}
			if(c==2) {
				if(arr[0]*arr[1]==a) {
					System.out.println("NO");
				}
				else {
					System.out.println("YES");
					int d = arr[0]*arr[1];
					System.out.println(arr[0]+" "+arr[1]+" "+a/d);
				}
			}
			else {
				System.out.println("NO");
			}
			c=0;
			i++;
			j=2;
		}

	}
}


import java.util.*;
public class GUC {
	static int cbrt(int g) {
		int k =2;
		while(true) {
			if(k*k*k>=g) {
				break;
			}
		}
		return k;
	}

	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();
		int i=0;
		double j =2;
		int c = 0;
		int a = 0;
		int[] arr= new int[2];
		while(i<n) {
			a = sc.nextInt();
			while(j<a) {
				if((a/j)%1==0){
					arr[c]=(int)j;
					c++;
				}
				if (c==2) {
					break;
				}
				j++;
			}
			if(c==2) {
				if(arr[0]*arr[1]==a) {
					System.out.println("NO");
				}
				else {
					System.out.println("YES");
					int d = arr[0]*arr[1];
					System.out.println(arr[0]+" "+arr[1]+" "+a/d);
				}
			}
			else {
				System.out.println("NO");
			}
			c=0;
			i++;
			j=2;
		}
	}
}


import java.util.*;
public class GUC {
	static int cbrt(int g) {
		int k =2;
		while(true) {
			if(k*k*k>=g) {
				break;
			}
		}
		return k;
	}

	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();
		int i=0;
		double j =2;
		int c = 0;
		int a = 0;
		int[] arr= new int[2];
		while(i<n) {
			a = sc.nextInt();
			while(j<a) {
				if((a/j)%1==0){
					arr[c]=(int)j;
					c++;
				}
				if (c==2) {
					break;
				}
				j++;
			}
			int d = arr[0]*arr[1];
			if(c==2) {
				if(arr[0]*arr[1]==a || a/d==arr[0] || a/d==arr[1]) {
					System.out.println("NO");
				}
				else {
					System.out.println("YES");
					System.out.println(arr[0]+" "+arr[1]+" "+a/d);
				}
			}
			else {
				System.out.println("NO");
			}
			c=0;
			i++;
			j=2;
		}
	}
}


import java.util.*;
public class GUC {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		byte t= sc.nextByte();
		byte i=0;
		byte c = 0;
		int j = 2;
		int[] arr = new int[2];
		while(i<t) {
			double a = sc.nextDouble();
			int b = (int) Math.ceil((Math.cbrt(a)));
			while(j<=b) {
				if((a/j)%1==0) {
					arr[c]=j;
					c++;

					if(c==2) {

					}
				j++;
				}
			}
			j=2;
			if(c==2) {
				System.out.println("YES");
				System.out.println(arr[0]+" "+arr[1]+" "+((int)((a/arr[0])/arr[0])));
			}
			else {
				System.out.println("NO");
			}
		}
	}
}


	import java.math.BigInteger;
		import java.sql.Array;
		import java.util.ArrayList;
			import java.util.Arrays;
			import java.util.Collection;
			import java.util.Collections;
			import java.util.Comparator;
			import java.util.HashMap;
			import java.util.InputMismatchException;
			import java.util.Iterator;
			import java.util.LinkedHashSet;
			import java.util.LinkedList;
			import java.util.List;
			import java.util.Map;
			import java.util.Map.Entry;
			import java.util.PriorityQueue;
			import java.util.Queue;
			import java.util.Scanner;
			import java.util.Set;
			import java.util.Stack;
			import java.io.BufferedReader;
			import java.io.IOException;
			import java.io.InputStream;
			import java.io.InputStreamReader;
			import java.util.Scanner;
			import java.util.StringTokenizer;
			import java.util.TreeMap;
			import java.util.TreeSet;

			public class Main {

				static InputReader rd=new InputReader(System.in);
				public static void main(String[] args) {
					Scanner sc=new Scanner(System.in);
					int t=sc.nextInt();

					while(t-->0) {

						int n=sc.nextInt();

						int a=1;
						if(isPrime(n)) {
							System.out.println("NO");
							continue;
						}
						int b=1;
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0) {a=i;break;}

						}
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0&&i!=a) {b=i;break;}

						}

						int c=n/(a*b);
						if(c!=1&&c!=a&&c!=b&&a!=1&&b!=1&&a!=n&&b!=n) {
							System.out.println("YES");
							System.out.print(a+" "+b+" "+c);
							System.out.println();
						}
						else {
							System.out.println("NO");
						}
					}
				}

				static class Helper{
					int val;int index;
					public Helper(int  val,int index) {

						this.val=val;
						this.index=index;
						// TODO Auto-generated constructor stub
					}
				}

			    static boolean isPrime(int n)
			    {
			        // Corner cases
			        if (n <= 1)
			            return false;
			        if (n <= 3)
			            return true;

			        // This is checked so that we can skip
			        // middle five numbers in below loop
			        if (n % 2 == 0 || n % 3 == 0)
			            return false;

			        for (int i = 5; i * i <= n; i = i + 6)
			            if (n % i == 0 || n % (i + 2) == 0)
			                return false;

			        return true;
			    }

				    /* Iterative Function to calculate
				       (x^y)%p in O(log y) */
				    static long power(long x, long y, long p)
				    {
				        // Initialize result
				        long res = 1;

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

				       if (x == 0) return 0; // In case x is divisible by p;

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

				            // y must be even now
				            // y = y / 2
				            y = y >> 1;
				            x = (x * x) % p;
				        }
				        return res;
				    }

				  static class InputReader {
				        private InputStream stream;
				        private byte[] buf = new byte[1024];
				        private int curChar;
				        private int numChars;
				        private SpaceCharFilter filter;

				        public InputReader(InputStream stream) {
				            this.stream = stream;
				        }

				        public int read() {
				            if (numChars == -1)
				                throw new InputMismatchException();
				            if (curChar >= numChars) {
				                curChar = 0;
				                try {
				                    numChars = stream.read(buf);
				                } catch (IOException e) {
				                    throw new InputMismatchException();
				                }
				                if (numChars <= 0)
				                    return -1;
				            }
				            return buf[curChar++];
				        }

				        public int readInt() {
				            int c = read();
				            while (isSpaceChar(c))
				                c = read();
				            int sgn = 1;
				            if (c == '-') {
			    sgn = -1;
			    c = read();
			}
			int res = 0;
			do {
			    if (c < '0' || c > '9')
			        throw new InputMismatchException();
			    res *= 10;
			    res += c - '0';
			        c = read();
			    } while (!isSpaceChar(c));
			    return res * sgn;
			}

			public String readString() {
			    int c = read();
			    while (isSpaceChar(c))
			        c = read();
			    StringBuilder res = new StringBuilder();
			    do {
			        res.appendCodePoint(c);
			        c = read();
			    } while (!isSpaceChar(c));
			    return res.toString();
			}

			public boolean isSpaceChar(int c) {
			    if (filter != null)
			        return filter.isSpaceChar(c);
			    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				        }

				        public String next() {
				            return readString();
				        }

				    }

				  public interface SpaceCharFilter {
				        public boolean isSpaceChar(int ch);
				    }

			}


	import java.math.BigInteger;
		import java.sql.Array;
		import java.util.ArrayList;
			import java.util.Arrays;
			import java.util.Collection;
			import java.util.Collections;
			import java.util.Comparator;
			import java.util.HashMap;
			import java.util.InputMismatchException;
			import java.util.Iterator;
			import java.util.LinkedHashSet;
			import java.util.LinkedList;
			import java.util.List;
			import java.util.Map;
			import java.util.Map.Entry;
			import java.util.PriorityQueue;
			import java.util.Queue;
			import java.util.Scanner;
			import java.util.Set;
			import java.util.Stack;
			import java.io.BufferedReader;
			import java.io.IOException;
			import java.io.InputStream;
			import java.io.InputStreamReader;
			import java.util.Scanner;
			import java.util.StringTokenizer;
			import java.util.TreeMap;
			import java.util.TreeSet;

			public class Main {

				static InputReader rd=new InputReader(System.in);
				public static void main(String[] args) {
					Scanner sc=new Scanner(System.in);
					int t=sc.nextInt();

					while(t-->0) {

						int n=sc.nextInt();

						int a=1;
						if(isPrime(n)) {
							System.out.println("NO");
							continue;
						}
						int b=1;
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0) {a=i;break;}

						}

						for(int i=2;i<Math.sqrt(n/a);i++) {
							if((n/2)%i==0&&i!=a) {b=i;break;}

						}

						int c=n/(a*b);
						if(c!=1&&c!=a&&c!=b&&a!=1&&b!=1&&a!=n&&b!=n) {
							System.out.println("YES");
							System.out.print(a+" "+b+" "+c);
							System.out.println();
						}
						else {
							System.out.println("NO");
						}
					}
				}

				static class Helper{
					int val;int index;
					public Helper(int  val,int index) {

						this.val=val;
						this.index=index;
						// TODO Auto-generated constructor stub
					}
				}

			    static boolean isPrime(int n)
			    {
			        // Corner cases
			        if (n <= 1)
			            return false;
			        if (n <= 3)
			            return true;

			        // This is checked so that we can skip
			        // middle five numbers in below loop
			        if (n % 2 == 0 || n % 3 == 0)
			            return false;

			        for (int i = 5; i * i <= n; i = i + 6)
			            if (n % i == 0 || n % (i + 2) == 0)
			                return false;

			        return true;
			    }

				    /* Iterative Function to calculate
				       (x^y)%p in O(log y) */
				    static long power(long x, long y, long p)
				    {
				        // Initialize result
				        long res = 1;

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

				       if (x == 0) return 0; // In case x is divisible by p;

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

				            // y must be even now
				            // y = y / 2
				            y = y >> 1;
				            x = (x * x) % p;
				        }
				        return res;
				    }

				  static class InputReader {
				        private InputStream stream;
				        private byte[] buf = new byte[1024];
				        private int curChar;
				        private int numChars;
				        private SpaceCharFilter filter;

				        public InputReader(InputStream stream) {
				            this.stream = stream;
				        }

				        public int read() {
				            if (numChars == -1)
				                throw new InputMismatchException();
				            if (curChar >= numChars) {
				                curChar = 0;
				                try {
				                    numChars = stream.read(buf);
				                } catch (IOException e) {
				                    throw new InputMismatchException();
				                }
				                if (numChars <= 0)
				                    return -1;
				            }
				            return buf[curChar++];
				        }

				        public int readInt() {
				            int c = read();
				            while (isSpaceChar(c))
				                c = read();
				            int sgn = 1;
				            if (c == '-') {
			    sgn = -1;
			    c = read();
			}
			int res = 0;
			do {
			    if (c < '0' || c > '9')
			        throw new InputMismatchException();
			    res *= 10;
			    res += c - '0';
			        c = read();
			    } while (!isSpaceChar(c));
			    return res * sgn;
			}

			public String readString() {
			    int c = read();
			    while (isSpaceChar(c))
			        c = read();
			    StringBuilder res = new StringBuilder();
			    do {
			        res.appendCodePoint(c);
			        c = read();
			    } while (!isSpaceChar(c));
			    return res.toString();
			}

			public boolean isSpaceChar(int c) {
			    if (filter != null)
			        return filter.isSpaceChar(c);
			    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				        }

				        public String next() {
				            return readString();
				        }

				    }

				  public interface SpaceCharFilter {
				        public boolean isSpaceChar(int ch);
				    }

			}


	import java.math.BigInteger;
		import java.sql.Array;
		import java.util.ArrayList;
			import java.util.Arrays;
			import java.util.Collection;
			import java.util.Collections;
			import java.util.Comparator;
			import java.util.HashMap;
			import java.util.InputMismatchException;
			import java.util.Iterator;
			import java.util.LinkedHashSet;
			import java.util.LinkedList;
			import java.util.List;
			import java.util.Map;
			import java.util.Map.Entry;
			import java.util.PriorityQueue;
			import java.util.Queue;
			import java.util.Scanner;
			import java.util.Set;
			import java.util.Stack;
			import java.io.BufferedReader;
			import java.io.IOException;
			import java.io.InputStream;
			import java.io.InputStreamReader;
			import java.util.Scanner;
			import java.util.StringTokenizer;
			import java.util.TreeMap;
			import java.util.TreeSet;

			public class Main {

				static InputReader rd=new InputReader(System.in);
				public static void main(String[] args) {
					Scanner sc=new Scanner(System.in);
					int t=sc.nextInt();

					while(t-->0) {

						int n=sc.nextInt();

						int a=1;
						if(isPrime(n)) {
							System.out.println("NO");
							continue;
						}
						int b=1;
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0) {a=i;break;}

						}
						for(int i=(int)Math.sqrt(n);i>2;i--) {
							if(n%i==0) {b=i;break;}

						}

						int c=n/(a*b);
						if(c!=1&&c!=a&&c!=b) {
							System.out.println("YES");
							System.out.print(a+" "+b+" "+c);
							System.out.println();
						}
						else {
							System.out.println("NO");
						}
					}
				}

				static class Helper{
					int val;int index;
					public Helper(int  val,int index) {

						this.val=val;
						this.index=index;
						// TODO Auto-generated constructor stub
					}
				}

			    static boolean isPrime(int n)
			    {
			        // Corner cases
			        if (n <= 1)
			            return false;
			        if (n <= 3)
			            return true;

			        // This is checked so that we can skip
			        // middle five numbers in below loop
			        if (n % 2 == 0 || n % 3 == 0)
			            return false;

			        for (int i = 5; i * i <= n; i = i + 6)
			            if (n % i == 0 || n % (i + 2) == 0)
			                return false;

			        return true;
			    }

				    /* Iterative Function to calculate
				       (x^y)%p in O(log y) */
				    static long power(long x, long y, long p)
				    {
				        // Initialize result
				        long res = 1;

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

				       if (x == 0) return 0; // In case x is divisible by p;

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

				            // y must be even now
				            // y = y / 2
				            y = y >> 1;
				            x = (x * x) % p;
				        }
				        return res;
				    }

				  static class InputReader {
				        private InputStream stream;
				        private byte[] buf = new byte[1024];
				        private int curChar;
				        private int numChars;
				        private SpaceCharFilter filter;

				        public InputReader(InputStream stream) {
				            this.stream = stream;
				        }

				        public int read() {
				            if (numChars == -1)
				                throw new InputMismatchException();
				            if (curChar >= numChars) {
				                curChar = 0;
				                try {
				                    numChars = stream.read(buf);
				                } catch (IOException e) {
				                    throw new InputMismatchException();
				                }
				                if (numChars <= 0)
				                    return -1;
				            }
				            return buf[curChar++];
				        }

				        public int readInt() {
				            int c = read();
				            while (isSpaceChar(c))
				                c = read();
				            int sgn = 1;
				            if (c == '-') {
			    sgn = -1;
			    c = read();
			}
			int res = 0;
			do {
			    if (c < '0' || c > '9')
			        throw new InputMismatchException();
			    res *= 10;
			    res += c - '0';
			        c = read();
			    } while (!isSpaceChar(c));
			    return res * sgn;
			}

			public String readString() {
			    int c = read();
			    while (isSpaceChar(c))
			        c = read();
			    StringBuilder res = new StringBuilder();
			    do {
			        res.appendCodePoint(c);
			        c = read();
			    } while (!isSpaceChar(c));
			    return res.toString();
			}

			public boolean isSpaceChar(int c) {
			    if (filter != null)
			        return filter.isSpaceChar(c);
			    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				        }

				        public String next() {
				            return readString();
				        }

				    }

				  public interface SpaceCharFilter {
				        public boolean isSpaceChar(int ch);
				    }

			}


	import java.math.BigInteger;
		import java.sql.Array;
		import java.util.ArrayList;
			import java.util.Arrays;
			import java.util.Collection;
			import java.util.Collections;
			import java.util.Comparator;
			import java.util.HashMap;
			import java.util.InputMismatchException;
			import java.util.Iterator;
			import java.util.LinkedHashSet;
			import java.util.LinkedList;
			import java.util.List;
			import java.util.Map;
			import java.util.Map.Entry;
			import java.util.PriorityQueue;
			import java.util.Queue;
			import java.util.Scanner;
			import java.util.Set;
			import java.util.Stack;
			import java.io.BufferedReader;
			import java.io.IOException;
			import java.io.InputStream;
			import java.io.InputStreamReader;
			import java.util.Scanner;
			import java.util.StringTokenizer;
			import java.util.TreeMap;
			import java.util.TreeSet;

			public class Main {

				static InputReader rd=new InputReader(System.in);
				public static void main(String[] args) {
					Scanner sc=new Scanner(System.in);
					int t=sc.nextInt();

					while(t-->0) {

						int n=sc.nextInt();

						int a=1;
						if(isPrime(n)) {
							System.out.println("NO");
							continue;
						}
						int b=1;
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0) {a=i;break;}

						}
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0&&i!=a&&i%a!=0) {b=i;break;}

						}

						int c=n/(a*b);
						if(c!=1&&c!=a&&c!=b&&a!=1&&b!=1&&a!=n&&b!=n) {
							System.out.println("YES");
							System.out.print(a+" "+b+" "+c);
							System.out.println();
						}
						else {
							System.out.println("NO");
						}
					}
				}

				static class Helper{
					int val;int index;
					public Helper(int  val,int index) {

						this.val=val;
						this.index=index;
						// TODO Auto-generated constructor stub
					}
				}

			    static boolean isPrime(int n)
			    {
			        // Corner cases
			        if (n <= 1)
			            return false;
			        if (n <= 3)
			            return true;

			        // This is checked so that we can skip
			        // middle five numbers in below loop
			        if (n % 2 == 0 || n % 3 == 0)
			            return false;

			        for (int i = 5; i * i <= n; i = i + 6)
			            if (n % i == 0 || n % (i + 2) == 0)
			                return false;

			        return true;
			    }

				    /* Iterative Function to calculate
				       (x^y)%p in O(log y) */
				    static long power(long x, long y, long p)
				    {
				        // Initialize result
				        long res = 1;

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

				       if (x == 0) return 0; // In case x is divisible by p;

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

				            // y must be even now
				            // y = y / 2
				            y = y >> 1;
				            x = (x * x) % p;
				        }
				        return res;
				    }

				  static class InputReader {
				        private InputStream stream;
				        private byte[] buf = new byte[1024];
				        private int curChar;
				        private int numChars;
				        private SpaceCharFilter filter;

				        public InputReader(InputStream stream) {
				            this.stream = stream;
				        }

				        public int read() {
				            if (numChars == -1)
				                throw new InputMismatchException();
				            if (curChar >= numChars) {
				                curChar = 0;
				                try {
				                    numChars = stream.read(buf);
				                } catch (IOException e) {
				                    throw new InputMismatchException();
				                }
				                if (numChars <= 0)
				                    return -1;
				            }
				            return buf[curChar++];
				        }

				        public int readInt() {
				            int c = read();
				            while (isSpaceChar(c))
				                c = read();
				            int sgn = 1;
				            if (c == '-') {
			    sgn = -1;
			    c = read();
			}
			int res = 0;
			do {
			    if (c < '0' || c > '9')
			        throw new InputMismatchException();
			    res *= 10;
			    res += c - '0';
			        c = read();
			    } while (!isSpaceChar(c));
			    return res * sgn;
			}

			public String readString() {
			    int c = read();
			    while (isSpaceChar(c))
			        c = read();
			    StringBuilder res = new StringBuilder();
			    do {
			        res.appendCodePoint(c);
			        c = read();
			    } while (!isSpaceChar(c));
			    return res.toString();
			}

			public boolean isSpaceChar(int c) {
			    if (filter != null)
			        return filter.isSpaceChar(c);
			    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				        }

				        public String next() {
				            return readString();
				        }

				    }

				  public interface SpaceCharFilter {
				        public boolean isSpaceChar(int ch);
				    }

			}


	import java.math.BigInteger;
		import java.sql.Array;
		import java.util.ArrayList;
			import java.util.Arrays;
			import java.util.Collection;
			import java.util.Collections;
			import java.util.Comparator;
			import java.util.HashMap;
			import java.util.InputMismatchException;
			import java.util.Iterator;
			import java.util.LinkedHashSet;
			import java.util.LinkedList;
			import java.util.List;
			import java.util.Map;
			import java.util.Map.Entry;
			import java.util.PriorityQueue;
			import java.util.Queue;
			import java.util.Scanner;
			import java.util.Set;
			import java.util.Stack;
			import java.io.BufferedReader;
			import java.io.IOException;
			import java.io.InputStream;
			import java.io.InputStreamReader;
			import java.util.Scanner;
			import java.util.StringTokenizer;
			import java.util.TreeMap;
			import java.util.TreeSet;

			public class Main {

				static InputReader rd=new InputReader(System.in);
				public static void main(String[] args) {
					Scanner sc=new Scanner(System.in);
					int t=sc.nextInt();

					while(t-->0) {

						int n=sc.nextInt();

						int a=1;
						if(isPrime(n)) {
							System.out.println("NO");
							continue;
						}
						int b=1;
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0) {a=i;break;}

						}
						for(int i=(int)Math.sqrt(n);i>2;i--) {
							if(n%i==0) {b=i;break;}

						}

						int c=n/(a*b);
						if(c!=1&&c!=a&&c!=b&&a!=1&&b!=1&&a!=n&&b!=n) {
							System.out.println("YES");
							System.out.print(a+" "+b+" "+c);
							System.out.println();
						}
						else {
							System.out.println("NO");
						}
					}
				}

				static class Helper{
					int val;int index;
					public Helper(int  val,int index) {

						this.val=val;
						this.index=index;
						// TODO Auto-generated constructor stub
					}
				}

			    static boolean isPrime(int n)
			    {
			        // Corner cases
			        if (n <= 1)
			            return false;
			        if (n <= 3)
			            return true;

			        // This is checked so that we can skip
			        // middle five numbers in below loop
			        if (n % 2 == 0 || n % 3 == 0)
			            return false;

			        for (int i = 5; i * i <= n; i = i + 6)
			            if (n % i == 0 || n % (i + 2) == 0)
			                return false;

			        return true;
			    }

				    /* Iterative Function to calculate
				       (x^y)%p in O(log y) */
				    static long power(long x, long y, long p)
				    {
				        // Initialize result
				        long res = 1;

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

				       if (x == 0) return 0; // In case x is divisible by p;

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

				            // y must be even now
				            // y = y / 2
				            y = y >> 1;
				            x = (x * x) % p;
				        }
				        return res;
				    }

				  static class InputReader {
				        private InputStream stream;
				        private byte[] buf = new byte[1024];
				        private int curChar;
				        private int numChars;
				        private SpaceCharFilter filter;

				        public InputReader(InputStream stream) {
				            this.stream = stream;
				        }

				        public int read() {
				            if (numChars == -1)
				                throw new InputMismatchException();
				            if (curChar >= numChars) {
				                curChar = 0;
				                try {
				                    numChars = stream.read(buf);
				                } catch (IOException e) {
				                    throw new InputMismatchException();
				                }
				                if (numChars <= 0)
				                    return -1;
				            }
				            return buf[curChar++];
				        }

				        public int readInt() {
				            int c = read();
				            while (isSpaceChar(c))
				                c = read();
				            int sgn = 1;
				            if (c == '-') {
			    sgn = -1;
			    c = read();
			}
			int res = 0;
			do {
			    if (c < '0' || c > '9')
			        throw new InputMismatchException();
			    res *= 10;
			    res += c - '0';
			        c = read();
			    } while (!isSpaceChar(c));
			    return res * sgn;
			}

			public String readString() {
			    int c = read();
			    while (isSpaceChar(c))
			        c = read();
			    StringBuilder res = new StringBuilder();
			    do {
			        res.appendCodePoint(c);
			        c = read();
			    } while (!isSpaceChar(c));
			    return res.toString();
			}

			public boolean isSpaceChar(int c) {
			    if (filter != null)
			        return filter.isSpaceChar(c);
			    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				        }

				        public String next() {
				            return readString();
				        }

				    }

				  public interface SpaceCharFilter {
				        public boolean isSpaceChar(int ch);
				    }

			}


	import java.math.BigInteger;
		import java.sql.Array;
		import java.util.ArrayList;
			import java.util.Arrays;
			import java.util.Collection;
			import java.util.Collections;
			import java.util.Comparator;
			import java.util.HashMap;
			import java.util.InputMismatchException;
			import java.util.Iterator;
			import java.util.LinkedHashSet;
			import java.util.LinkedList;
			import java.util.List;
			import java.util.Map;
			import java.util.Map.Entry;
			import java.util.PriorityQueue;
			import java.util.Queue;
			import java.util.Scanner;
			import java.util.Set;
			import java.util.Stack;
			import java.io.BufferedReader;
			import java.io.IOException;
			import java.io.InputStream;
			import java.io.InputStreamReader;
			import java.util.Scanner;
			import java.util.StringTokenizer;
			import java.util.TreeMap;
			import java.util.TreeSet;

			public class Main {

				static InputReader rd=new InputReader(System.in);
				public static void main(String[] args) {
					Scanner sc=new Scanner(System.in);
					int t=sc.nextInt();

					while(t-->0) {

						int n=sc.nextInt();

						int a=1;
						if(isPrime(n)) {
							System.out.println("NO");
							continue;
						}
						int b=1;
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0) {a=i;break;}

						}

						for(int i=2;i<Math.sqrt(n/a);i++) {
							if((n/a)%i==0&&i!=a) {b=i;break;}

						}

						int c=n/(a*b);
						if(c!=1&&c!=a&&c!=b&&a!=1&&b!=1&&a!=n&&b!=n) {
							System.out.println("YES");
							System.out.print(a+" "+b+" "+c);
							System.out.println();
						}
						else {
							System.out.println("NO");
						}
					}
				}

				static class Helper{
					int val;int index;
					public Helper(int  val,int index) {

						this.val=val;
						this.index=index;
						// TODO Auto-generated constructor stub
					}
				}

			    static boolean isPrime(int n)
			    {
			        // Corner cases
			        if (n <= 1)
			            return false;
			        if (n <= 3)
			            return true;

			        // This is checked so that we can skip
			        // middle five numbers in below loop
			        if (n % 2 == 0 || n % 3 == 0)
			            return false;

			        for (int i = 5; i * i <= n; i = i + 6)
			            if (n % i == 0 || n % (i + 2) == 0)
			                return false;

			        return true;
			    }

				    /* Iterative Function to calculate
				       (x^y)%p in O(log y) */
				    static long power(long x, long y, long p)
				    {
				        // Initialize result
				        long res = 1;

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

				       if (x == 0) return 0; // In case x is divisible by p;

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

				            // y must be even now
				            // y = y / 2
				            y = y >> 1;
				            x = (x * x) % p;
				        }
				        return res;
				    }

				  static class InputReader {
				        private InputStream stream;
				        private byte[] buf = new byte[1024];
				        private int curChar;
				        private int numChars;
				        private SpaceCharFilter filter;

				        public InputReader(InputStream stream) {
				            this.stream = stream;
				        }

				        public int read() {
				            if (numChars == -1)
				                throw new InputMismatchException();
				            if (curChar >= numChars) {
				                curChar = 0;
				                try {
				                    numChars = stream.read(buf);
				                } catch (IOException e) {
				                    throw new InputMismatchException();
				                }
				                if (numChars <= 0)
				                    return -1;
				            }
				            return buf[curChar++];
				        }

				        public int readInt() {
				            int c = read();
				            while (isSpaceChar(c))
				                c = read();
				            int sgn = 1;
				            if (c == '-') {
			    sgn = -1;
			    c = read();
			}
			int res = 0;
			do {
			    if (c < '0' || c > '9')
			        throw new InputMismatchException();
			    res *= 10;
			    res += c - '0';
			        c = read();
			    } while (!isSpaceChar(c));
			    return res * sgn;
			}

			public String readString() {
			    int c = read();
			    while (isSpaceChar(c))
			        c = read();
			    StringBuilder res = new StringBuilder();
			    do {
			        res.appendCodePoint(c);
			        c = read();
			    } while (!isSpaceChar(c));
			    return res.toString();
			}

			public boolean isSpaceChar(int c) {
			    if (filter != null)
			        return filter.isSpaceChar(c);
			    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				        }

				        public String next() {
				            return readString();
				        }

				    }

				  public interface SpaceCharFilter {
				        public boolean isSpaceChar(int ch);
				    }

			}


	import java.math.BigInteger;
		import java.sql.Array;
		import java.util.ArrayList;
			import java.util.Arrays;
			import java.util.Collection;
			import java.util.Collections;
			import java.util.Comparator;
			import java.util.HashMap;
			import java.util.InputMismatchException;
			import java.util.Iterator;
			import java.util.LinkedHashSet;
			import java.util.LinkedList;
			import java.util.List;
			import java.util.Map;
			import java.util.Map.Entry;
			import java.util.PriorityQueue;
			import java.util.Queue;
			import java.util.Scanner;
			import java.util.Set;
			import java.util.Stack;
			import java.io.BufferedReader;
			import java.io.IOException;
			import java.io.InputStream;
			import java.io.InputStreamReader;
			import java.util.Scanner;
			import java.util.StringTokenizer;
			import java.util.TreeMap;
			import java.util.TreeSet;

			public class Main {

				static InputReader rd=new InputReader(System.in);
				public static void main(String[] args) {
					Scanner sc=new Scanner(System.in);
					int t=sc.nextInt();

					while(t-->0) {

						int n=sc.nextInt();

						int a=1;
						if(isPrime(n)) {
							System.out.println("NO");
							continue;
						}
						int b=1;
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0) {a=i;break;}

						}
						for(int i=2;i<Math.sqrt(n/a);i++) {
							if(n%i==0&&i!=a) {b=i;break;}

						}

						int c=n/(a*b);
						if(c!=1&&c!=a&&c!=b&&a!=1&&b!=1&&a!=n&&b!=n) {
							System.out.println("YES");
							System.out.print(a+" "+b+" "+c);
							System.out.println();
						}
						else {
							System.out.println("NO");
						}
					}
				}

				static class Helper{
					int val;int index;
					public Helper(int  val,int index) {

						this.val=val;
						this.index=index;
						// TODO Auto-generated constructor stub
					}
				}

			    static boolean isPrime(int n)
			    {
			        // Corner cases
			        if (n <= 1)
			            return false;
			        if (n <= 3)
			            return true;

			        // This is checked so that we can skip
			        // middle five numbers in below loop
			        if (n % 2 == 0 || n % 3 == 0)
			            return false;

			        for (int i = 5; i * i <= n; i = i + 6)
			            if (n % i == 0 || n % (i + 2) == 0)
			                return false;

			        return true;
			    }

				    /* Iterative Function to calculate
				       (x^y)%p in O(log y) */
				    static long power(long x, long y, long p)
				    {
				        // Initialize result
				        long res = 1;

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

				       if (x == 0) return 0; // In case x is divisible by p;

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

				            // y must be even now
				            // y = y / 2
				            y = y >> 1;
				            x = (x * x) % p;
				        }
				        return res;
				    }

				  static class InputReader {
				        private InputStream stream;
				        private byte[] buf = new byte[1024];
				        private int curChar;
				        private int numChars;
				        private SpaceCharFilter filter;

				        public InputReader(InputStream stream) {
				            this.stream = stream;
				        }

				        public int read() {
				            if (numChars == -1)
				                throw new InputMismatchException();
				            if (curChar >= numChars) {
				                curChar = 0;
				                try {
				                    numChars = stream.read(buf);
				                } catch (IOException e) {
				                    throw new InputMismatchException();
				                }
				                if (numChars <= 0)
				                    return -1;
				            }
				            return buf[curChar++];
				        }

				        public int readInt() {
				            int c = read();
				            while (isSpaceChar(c))
				                c = read();
				            int sgn = 1;
				            if (c == '-') {
			    sgn = -1;
			    c = read();
			}
			int res = 0;
			do {
			    if (c < '0' || c > '9')
			        throw new InputMismatchException();
			    res *= 10;
			    res += c - '0';
			        c = read();
			    } while (!isSpaceChar(c));
			    return res * sgn;
			}

			public String readString() {
			    int c = read();
			    while (isSpaceChar(c))
			        c = read();
			    StringBuilder res = new StringBuilder();
			    do {
			        res.appendCodePoint(c);
			        c = read();
			    } while (!isSpaceChar(c));
			    return res.toString();
			}

			public boolean isSpaceChar(int c) {
			    if (filter != null)
			        return filter.isSpaceChar(c);
			    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				        }

				        public String next() {
				            return readString();
				        }

				    }

				  public interface SpaceCharFilter {
				        public boolean isSpaceChar(int ch);
				    }

			}


	import java.math.BigInteger;
		import java.sql.Array;
		import java.util.ArrayList;
			import java.util.Arrays;
			import java.util.Collection;
			import java.util.Collections;
			import java.util.Comparator;
			import java.util.HashMap;
			import java.util.InputMismatchException;
			import java.util.Iterator;
			import java.util.LinkedHashSet;
			import java.util.LinkedList;
			import java.util.List;
			import java.util.Map;
			import java.util.Map.Entry;
			import java.util.PriorityQueue;
			import java.util.Queue;
			import java.util.Scanner;
			import java.util.Set;
			import java.util.Stack;
			import java.io.BufferedReader;
			import java.io.IOException;
			import java.io.InputStream;
			import java.io.InputStreamReader;
			import java.util.Scanner;
			import java.util.StringTokenizer;
			import java.util.TreeMap;
			import java.util.TreeSet;

			public class Main {

				static InputReader rd=new InputReader(System.in);
				public static void main(String[] args) {
					Scanner sc=new Scanner(System.in);
					int t=sc.nextInt();

					while(t-->0) {

						int n=sc.nextInt();

						int a=1;
						if(isPrime(n)) {
							System.out.println("NO");
							continue;
						}
						int b=1;
						for(int i=2;i<Math.sqrt(n);i++) {
							if(n%i==0) {a=i;break;}

						}
						for(int i=(int)Math.sqrt(n);i>2;i++) {
							if(n%i==0) {b=i;break;}

						}

						int c=n/(a*b);
						if(c!=1&&c!=a&&c!=b) {
							System.out.println("YES");
							System.out.print(a+" "+b+" "+c);
							System.out.println();
						}
						else {
							System.out.println("NO");
						}
					}
				}

				static class Helper{
					int val;int index;
					public Helper(int  val,int index) {

						this.val=val;
						this.index=index;
						// TODO Auto-generated constructor stub
					}
				}

			    static boolean isPrime(int n)
			    {
			        // Corner cases
			        if (n <= 1)
			            return false;
			        if (n <= 3)
			            return true;

			        // This is checked so that we can skip
			        // middle five numbers in below loop
			        if (n % 2 == 0 || n % 3 == 0)
			            return false;

			        for (int i = 5; i * i <= n; i = i + 6)
			            if (n % i == 0 || n % (i + 2) == 0)
			                return false;

			        return true;
			    }

				    /* Iterative Function to calculate
				       (x^y)%p in O(log y) */
				    static long power(long x, long y, long p)
				    {
				        // Initialize result
				        long res = 1;

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

				       if (x == 0) return 0; // In case x is divisible by p;

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

				            // y must be even now
				            // y = y / 2
				            y = y >> 1;
				            x = (x * x) % p;
				        }
				        return res;
				    }

				  static class InputReader {
				        private InputStream stream;
				        private byte[] buf = new byte[1024];
				        private int curChar;
				        private int numChars;
				        private SpaceCharFilter filter;

				        public InputReader(InputStream stream) {
				            this.stream = stream;
				        }

				        public int read() {
				            if (numChars == -1)
				                throw new InputMismatchException();
				            if (curChar >= numChars) {
				                curChar = 0;
				                try {
				                    numChars = stream.read(buf);
				                } catch (IOException e) {
				                    throw new InputMismatchException();
				                }
				                if (numChars <= 0)
				                    return -1;
				            }
				            return buf[curChar++];
				        }

				        public int readInt() {
				            int c = read();
				            while (isSpaceChar(c))
				                c = read();
				            int sgn = 1;
				            if (c == '-') {
			    sgn = -1;
			    c = read();
			}
			int res = 0;
			do {
			    if (c < '0' || c > '9')
			        throw new InputMismatchException();
			    res *= 10;
			    res += c - '0';
			        c = read();
			    } while (!isSpaceChar(c));
			    return res * sgn;
			}

			public String readString() {
			    int c = read();
			    while (isSpaceChar(c))
			        c = read();
			    StringBuilder res = new StringBuilder();
			    do {
			        res.appendCodePoint(c);
			        c = read();
			    } while (!isSpaceChar(c));
			    return res.toString();
			}

			public boolean isSpaceChar(int c) {
			    if (filter != null)
			        return filter.isSpaceChar(c);
			    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				        }

				        public String next() {
				            return readString();
				        }

				    }

				  public interface SpaceCharFilter {
				        public boolean isSpaceChar(int ch);
				    }

			}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ProductOfNumbers {
    static StringBuilder sb;

    public static void main(String[] args) throws IOException {
        int t;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        t = Integer.parseInt(br.readLine());
        sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            solve(sb, n);

        }

        System.out.println(sb);
    }

    private static void solve(StringBuilder sb, int n) {
//        System.out.println("for  : " + n);

        Map<Integer, Integer> m = new HashMap<>();

        int num = n;
        int i = 0;
        for (i = 2; i * i <= n; i++) {
            int p = 0;
            while (n % i == 0) {
                n /= i;
                ++p;
            }
            if (p > 0) m.put(i, p);
        }

        if (n > 1) m.put(n, 1);

        //System.out.println(m);

        if (m.size() == 0) {
            sb.append("NO\n");
        } else {

            if (m.size() == 1) {
                int v = 0;
                for (int val : m.values()) v += val;
                if (v < 6) sb.append("NO\n");
                else {
                    Set<Integer> keys = m.keySet();

                    int k = keys.iterator().next();
                    sb.append("YES\n");
                    int k2 = k * k;
                    int k3 = k2 * k;

                    //System.out.println(" ======  " +  k2 + "  |  " + (num/k2));
                    sb.append(k + " " + k2 + " " + (num / k3) + "\n");
                }
            } else if (m.size() >= 3) {
                int v = 0;
                for (int value : m.values()) v += value;
                //sb.append("YES\n");
                Set<Integer> keys = m.keySet();
                Iterator<Integer> it = keys.iterator();
                long k1 = it.next();
                k1 = (long)Math.pow(k1, m.get(k1));
                long k2 = it.next();
                k2 = (long)Math.pow(k2, m.get(k2));

                long rem = (num / (k1 * k2));
                sb.append(k1 + " " + k2 + " " + rem + "\n");

            } else if (m.size() == 2) {
                int v = 0;
                for (int val : m.values()) v += val;

                Set<Integer> keys = m.keySet();

                Iterator<Integer> it = keys.iterator();
                int k = it.next();
                int k2 = it.next();
                int k3 = num / (k * k2);

                if (k3 == k || k3 == k2 || k3 == 1) {
                    sb.append("NO\n");
                } else {
                    sb.append("YES\n" + k + " " + k2 + " " + k3 + "\n");
                }
            } else {
                sb.append("NO\n");
            }
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ProductOfNumbers {
    static StringBuilder sb;

    public static void main(String[] args) throws IOException {
        int t;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        t = Integer.parseInt(br.readLine());
        sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            solve(sb, n);

        }

        System.out.println(sb);
    }

    private static void solve(StringBuilder sb, int n) {
//        System.out.println("for  : " + n);

        Map<Integer, Integer> m = new HashMap<>();

        int num = n;
        int i = 0;
        for (i = 2; i * i <= n; i++) {
            int p = 0;
            while (n % i == 0) {
                n /= i;
                ++p;
            }
            if (p > 0) m.put(i, p);
        }

        if (n > 1) m.put(num, 1);

        // System.out.println(m);

        if (m.size() == 0) {
            sb.append("NO\n");
        } else if (m.size() == 1) {
            int v = 0;
            for (int val : m.values()) v += val;
            if (v < 6) sb.append("NO\n");
            else {
                Set<Integer> keys = m.keySet();

                int k = keys.iterator().next();
                sb.append("YES\n");
                int k2 = k * k;
                int k3 = k2 * k;

                //System.out.println(" ======  " +  k2 + "  |  " + (num/k2));
                sb.append(k + " " + k2 + " " + (num / k3) + "\n");
            }
        } else if (m.size() >= 3) {
            int v = 0;
            for (int value : m.values()) v += value;
            //sb.append("YES\n");
            Set<Integer> keys = m.keySet();
            Iterator<Integer> it = keys.iterator();
            long k1 = it.next();
            long k2 = it.next();

            long rem = (num / (k1 * k2));
            sb.append(k1 + " " + k2 + " " + rem + "\n");

        } else if (m.size() == 2) {
            int v = 0;
            for (int val : m.values()) v += val;

                Set<Integer> keys = m.keySet();

                Iterator<Integer> it = keys.iterator();
                int k = it.next();
                sb.append("YES\n");
                int k2 = it.next();
                int k3 = num / (k * k2);

                if (k3 == k || k3 == k2) {
                    sb.append("NO\n");
                } else {
                    sb.append("YES\n" + k + " " + k2 + " " + k3 + "\n");
                }
        } else {
            sb.append("NO\n");
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ProductOfNumbers {
    static StringBuilder sb;

    public static void main(String[] args) throws IOException {
        int t;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        t = Integer.parseInt(br.readLine());
        sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            solve(sb, n);

        }

        System.out.println(sb);
    }

    private static void solve(StringBuilder sb, int n) {
//        System.out.println("for  : " + n);

        Map<Integer, Integer> m = new HashMap<>();

        int num = n;
        int i = 0;
        for (i = 2; i * i <= n; i++) {
            int p = 0;
            while (n % i == 0) {
                n /= i;
                ++p;
            }
            if (p > 0) m.put(i, p);
        }

        if (n > 1) m.put(n, 1);

        //System.out.println(m);

        m.remove(0);
        if (m.size() == 0) {
            sb.append("NO\n");
        } else {

            if (m.size() == 1) {
                int v = 0;
                for (int val : m.values()) v += val;
                if (v < 6) sb.append("NO\n");
                else {
                    Set<Integer> keys = m.keySet();

                    int k = keys.iterator().next();
                    sb.append("YES\n");
                    int k2 = k * k;
                    int k3 = k2 * k;

                    //System.out.println(" ======  " +  k2 + "  |  " + (num/k2));
                    sb.append(k + " " + k2 + " " + (num / k3) + "\n");
                }
            } else if (m.size() >= 3) {
                //int v = 0;
                //for (int value : m.values()) v += value;
                sb.append("YES\n");
                Set<Integer> keys = m.keySet();
                Iterator<Integer> it = keys.iterator();
                long k1 = it.next();
                k1 = (long)Math.pow(k1, m.get(k1));
                long k2 = it.next();
                k2 = (long)Math.pow(k2, m.get(k2));

                long rem = (num / (k1 * k2));
                sb.append(k1 + " " + k2 + " " + rem + "\n");

            } else if (m.size() == 2) {
                int v = 0;
                for (int val : m.values()) v += val;

                Set<Integer> keys = m.keySet();

                Iterator<Integer> it = keys.iterator();
                int k = it.next();
                int k2 = it.next();
                int k3 = num / (k * k2);

                if (k3 == k || k3 == k2 || k3 == 1) {
                    sb.append("NO\n");
                } else {
                    sb.append("YES\n" + k + " " + k2 + " " + k3 + "\n");
                }
            } else {
                sb.append("NO\n");
            }
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ProductOfNumbers {
    static StringBuilder sb;

    public static void main(String[] args) throws IOException {
        int t;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        t = Integer.parseInt(br.readLine());
        sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            solve(sb, n);

        }

        System.out.println(sb);
    }

    private static void solve(StringBuilder sb, int n) {
//        System.out.println("for  : " + n);

        Map<Integer, Integer> m = new HashMap<>();

        int num = n;
        int i = 0;
        for (i = 2; i * i <= n; i++) {
            int p = 0;
            while (n % i == 0) {
                n /= i;
                ++p;
            }
            if (p > 0) m.put(i, p);
        }

        if (n > 1) m.put(num, 1);

//        System.out.println(m);

        if (m.size() == 0) {
            sb.append("NO\n");
        } else if (m.size() == 1) {
            int v = 0;
            for (int val : m.values()) v += val;
            if (v < 6) sb.append("NO\n");
            else {
                Set<Integer> keys = m.keySet();

                int k = keys.iterator().next();
                sb.append("YES\n");
                int k2 = k * k;
                int k3 = k2 * k;

                //System.out.println(" ======  " +  k2 + "  |  " + (num/k2));
                sb.append(k + " " + k2 + " " + (num / k3) + "\n");
            }
        } else if (m.size() >= 3) {
            int v = 0;
            for (int value : m.values()) v += value;
            if (v < 3) sb.append("NO\n");
            else {
                sb.append("YES\n");

                Set<Integer> keys = m.keySet();
                Iterator<Integer> it = keys.iterator();
                long k1 = it.next();
                //k1 = (long) Math.pow(k1, m.get(k1));
                long k2 = it.next();
                //k2 = (long) Math.pow(k2, m.get(k2));
//                long k3 = it.next();
//                k3 = (long) Math.pow(k3, m.get(k3));

                long rem = (num / (k1 * k2));
                sb.append(k1 + " " + k2 + " " + rem + "\n");
            }
        } else if (m.size() == 2) {
            int v = 0;
            for (int val : m.values()) v += val;
            if (v < 6) sb.append("NO\n");
            else {
                Set<Integer> keys = m.keySet();

                Iterator<Integer> it = keys.iterator();
                int k = it.next();
                sb.append("YES\n");
                int k2 = it.next();
                int k3 = num/(k * k2);

                //System.out.println(" ======  " +  k2 + "  |  " + (num/k2));
                sb.append(k + " " + k2 + " " + k3 + "\n");
            }
        } else {
            sb.append("NO\n");
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ProductOfNumbers {
    static StringBuilder sb;

    public static void main(String[] args) throws IOException {
        int t;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        t = Integer.parseInt(br.readLine());
        sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            solve(sb, n);

        }

        System.out.println(sb);
    }

    private static void solve(StringBuilder sb, int n) {
//        System.out.println("for  : " + n);

        Map<Integer, Integer> m = new HashMap<>();

        int num = n;
        int i = 0;
        for (i = 2; i * i <= n; i++) {
            int p = 0;
            while (n % i == 0) {
                n /= i;
                ++p;
            }
            if (p > 0) m.put(i, p);
        }

        if (n > 1) m.put(n, 1);

         //System.out.println(m);

        if (m.size() == 0) {
            sb.append("NO\n");
        } else if (m.size() == 1) {
            int v = 0;
            for (int val : m.values()) v += val;
            if (v < 6) sb.append("NO\n");
            else {
                Set<Integer> keys = m.keySet();

                int k = keys.iterator().next();
                sb.append("YES\n");
                int k2 = k * k;
                int k3 = k2 * k;

                //System.out.println(" ======  " +  k2 + "  |  " + (num/k2));
                sb.append(k + " " + k2 + " " + (num / k3) + "\n");
            }
        } else if (m.size() >= 3) {
            int v = 0;
            for (int value : m.values()) v += value;
            //sb.append("YES\n");
            Set<Integer> keys = m.keySet();
            Iterator<Integer> it = keys.iterator();
            long k1 = it.next();
            long k2 = it.next();

            long rem = (num / (k1 * k2));
            sb.append(k1 + " " + k2 + " " + rem + "\n");

        } else if (m.size() == 2) {
            int v = 0;
            for (int val : m.values()) v += val;

                Set<Integer> keys = m.keySet();

                Iterator<Integer> it = keys.iterator();
                int k = it.next();
                int k2 = it.next();
                int k3 = num / (k * k2);

                if (k3 == k || k3 == k2 || k3 == 1) {
                    sb.append("NO\n");
                } else {
                    sb.append("YES\n" + k + " " + k2 + " " + k3 + "\n");
                }
        } else {
            sb.append("NO\n");
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ProductOfNumbers {
    static StringBuilder sb;

    public static void main(String[] args) throws IOException {
        int t;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        t = Integer.parseInt(br.readLine());
        sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            solve(sb, n);

        }

        System.out.println(sb);
    }

    private static void solve(StringBuilder sb, int n) {
        //System.out.println("for  : " + n);

        Map<Integer, Integer> m = new HashMap<>();

        int num = n;
        int i = 0;
        for (i = 2; i * i <= n; i++) {
            int p = 0;
            while (n % i == 0) {
                n /= i;
                ++p;
            }
            if (p > 0) m.put(i, p);
        }

        if (n > 1) m.put(n, 1);

        //System.out.println(m);

        m.remove(0);
        if (m.size() == 0) {
            sb.append("NO\n");
        } else {

            if (m.size() == 1) {
                int v = 0;
                for (int val : m.values()) v += val;
                if (v < 6) sb.append("NO\n");
                else {
                    Set<Integer> keys = m.keySet();

                    int k = keys.iterator().next();
                    sb.append("YES\n");
                    int k2 = k * k;
                    int k3 = k2 * k;

                    //System.out.println(" ======  " +  k2 + "  |  " + (num/k2));
                    sb.append(k + " " + k2 + " " + (num / k3) + "\n");
                }
            } else if (m.size() >= 3) {
                //int v = 0;
                //for (int value : m.values()) v += value;
                sb.append("YES\n");
                Set<Integer> keys = m.keySet();
                Iterator<Integer> it = keys.iterator();

                long k1 = it.next(); //System.out.println(k1 + " ===== ");
                k1 = (long)Math.pow(k1, m.get((int)k1));
                long k2 = it.next(); //System.out.println(k2 + " ===== ");
                k2 = (long)Math.pow(k2, m.get((int)k2));

                long rem = (num / (k1 * k2));
                sb.append(k1 + " " + k2 + " " + rem + "\n");

            } else if (m.size() == 2) {
                int v = 0;
                for (int val : m.values()) v += val;

                Set<Integer> keys = m.keySet();

                Iterator<Integer> it = keys.iterator();
                int k = it.next();
                int k2 = it.next();
                int k3 = num / (k * k2);

                if (k3 == k || k3 == k2 || k3 == 1) {
                    sb.append("NO\n");
                } else {
                    sb.append("YES\n" + k + " " + k2 + " " + k3 + "\n");
                }
            } else {
                sb.append("NO\n");
            }
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ProductOfNumbers {
    static StringBuilder sb;

    public static void main(String[] args) throws IOException {
        int t;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        t = Integer.parseInt(br.readLine());
        sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            solve(sb, n);

        }

        System.out.println(sb);
    }

    private static void solve(StringBuilder sb, int n) {
//        System.out.println("for  : " + n);

        Map<Integer, Integer> m = new HashMap<>();

        int num = n;
        int i = 0;
        for (i = 2; i * i <= n; i++) {
            int p = 0;
            while (n % i == 0) {
                n /= i;
                ++p;
            }
            if (p > 0) m.put(i, p);
        }

        if (n > 1) m.put(num, 1);

//        System.out.println(m);

        if (m.size() == 0) {
            sb.append("NO\n");
        } else if (m.size() == 1) {
            int v = 0;
            for (int val : m.values()) v += val;
            if (v < 6) sb.append("NO\n");
            else {
                Set<Integer> keys = m.keySet();

                int k = keys.iterator().next();
                sb.append("YES\n");
                int k2 = k * k;
                int k3 = k2 * k;

                //System.out.println(" ======  " +  k2 + "  |  " + (num/k2));
                sb.append(k + " " + k2 + " " + (num / k3) + "\n");
            }
        } else if (m.size() >= 3) {
            int v = 0;
            for (int value : m.values()) v += value;
            if (v < 3) sb.append("NO\n");
            else {
                sb.append("YES\n");

                Set<Integer> keys = m.keySet();
                Iterator<Integer> it = keys.iterator();

                int k1 = it.next();
                int k2 = it.next();
                long k1st = (long) Math.pow(k1, m.get(k1));
                long k2st = (long) Math.pow(k2, m.get(k2));
                long rem = (num / (k1st * k2st));
                sb.append(k1st + " " + k2st + " " + rem + "\n");
            }
        }
    }
}


import java.io.*;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int tc = sc.nextInt();
        main:
        while (tc-- > 0) {
            int n = sc.nextInt();
            LinkedList<Integer> q = new LinkedList();
            for (int i = 2; 1l * i * i <= n; i++) {
                int c = 1;
                HashSet<Integer> has = new HashSet<>();
                while (n % i == 0) {
                    c *= i;
                    n /= i;
                    if (!has.contains(c)) {
                        has.add(c);
                        q.add(c);
                        c = 1;
                    }
                }
                if (c != 1) {
                    if (!has.contains(c)) {
                        has.add(c);
                        q.add(c);
                    } else {
                        c = c * q.removeLast();
                        q.add(c);
                    }
                }

            }
            if (n != 1) q.add(n);
            if (q.size() < 3) out.println("NO");
            else {
                out.println("YES");
                out.print(q.remove() + " " + q.remove() + " ");
                int c = 1;
                while (!q.isEmpty()) c *= q.remove();
                out.println(c);
            }
        }
        out.flush();
        out.close();
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        boolean ready() throws IOException {
            return br.ready();
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}


import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int tc = sc.nextInt();
        main:
        while (tc-- > 0) {
            int n = sc.nextInt();
            for (int a = 2; 1l * a * a * a <= n; a++) {
                if (n % a != 0) continue;
                for (int b = a + 1; 1l * b * b * b <= n; b++) {
                    if (n % b != 0) continue;
                    int c = n / (a * b);
                    if (c != a && c != b) {
                        out.println("YES");
                        out.println(a + " " + b + " " + c);
                        continue main;
                    }
                }
            }
            out.println("NO");
        }
        out.flush();
        out.close();

    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        boolean ready() throws IOException {
            return br.ready();
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}


import java.io.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Main {

    static ArrayList<Integer> primes;
    static int N = (int) 1e6;

    static void sieve() {
        primes = new ArrayList<>();
        boolean[] notprime = new boolean[N];
        for (int i = 2; i < N; i++) {
            if (notprime[i]) continue;
            primes.add(i);
            if (1l * i * i < N)
                for (int j = i * i; j < N; j += i)
                    notprime[j] = true;
        }
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int tc = sc.nextInt();
        sieve();
        main:
        while (tc-- > 0) {
            int n = sc.nextInt();
            LinkedList<Integer> q = new LinkedList();
            for (int p : primes) {
                if (1l * p * p > n) break;
                int e = 0;
                while (n % p == 0) {
                    e++;
                    n /= p;
                }
                for (int i = 1; e >= i; i++) {
                    e -= i;
                    int add = 0;
                    if (e < i + 1) add += e;
                    q.add(pow(p, i + add));
                }
            }
            if (n != 1) q.add(n);
            if (q.size() < 3) out.println("NO");
            else {
                out.println("YES");
                out.print(q.remove() + " " + q.remove() + " ");
                int c = 1;
                while (!q.isEmpty()) c *= q.remove();
                out.println(c);
            }
        }
        out.flush();
        out.close();
    }

    static int pow(int b, int e) {
        int res = 1;
        while (e-- > 0) res *= b;
        return res;
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        boolean ready() throws IOException {
            return br.ready();
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}


import java.io.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

    static ArrayList<Integer> primes;
    static int N = (int) 1e6;

    static void sieve() {
        primes = new ArrayList<>();
        boolean[] notprime = new boolean[N];
        for (int i = 2; i < N; i++) {
            if (notprime[i]) continue;
            primes.add(i);
            if (1l * i * i < N)
                for (int j = i * i; j < N; j += i)
                    notprime[j] = true;
        }
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int tc = sc.nextInt();
        sieve();
        main:
        while (tc-- > 0) {
            int n = sc.nextInt();
            LinkedList<Integer> q = new LinkedList();
            for (int p : primes) {
                if (1l * p * p > n) break;
                while (n % p == 0) {
                    n /= p;
                    q.add(p);
                }
            }
            if (n != 1) q.add(n);
            TreeSet<Integer> ans = new TreeSet<>();
            while (!q.isEmpty()) {
                int cur = q.removeFirst();
                while (ans.contains(cur)) {
                    if (q.isEmpty()) {
                        int max = ans.last();
                        cur *= max;
                        ans.remove(max);
                    } else cur = cur * q.removeFirst();
                }
                ans.add(cur);
            }
            if (ans.size() < 3) out.println("NO");
            else {
                out.println("YES");
                int a = -1, b = -1, c = 1;
                for (int x : ans) {
                    if (a == -1) a = x;
                    else if (b == -1) b = x;
                    else c *= x;
                }
                out.println(a + " " + b + " " + c);
            }
        }
        out.flush();
        out.close();
    }

    static int pow(int b, int e) {
        int res = 1;
        while (e-- > 0) res *= b;
        return res;
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        boolean ready() throws IOException {
            return br.ready();
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}