#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pi 3.141592653589793238462643383279502884197169399375105820974944
using namespace std;
bool isPrime(ll int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 


//Binomial coefficient code taken from geeks from geeks
ll int bin(ll int n,ll int r,ll int p) 
{  
    if (r > n - r) 
        r = n - r;  
    ll int C[r + 1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;
    for (ll int i = 1; i <= n; i++) 
	{
        for (ll int j = min(i, r); j > 0; j--)
		{
			C[j] = (C[j] + C[j - 1]) % p;	
		}  
    } 
    return max(1ll,C[r]); 
}

ll int fac(ll int n,ll int mod)
{
	ll int i;
	ll int p=1;
	for(i=1;i<=n;i++)
	{
		p=(p*i)%mod;
	}
	return p;
}

int calc(int r,int time,int p)
{
	int low=0,high=p,prata=0;
	while(low<=high)
	{
		int mid=low+(high-low)/2;
		if(r*(mid*(mid+1))/2 <= time)
		{
			prata=mid;
			low=mid+1;
		}
		else
		{
			high=mid-1;
		}
	}
	return prata;
}

int main()
{
	int t=1;
	cin>>t;
	while(t--)
	{
		ll int n;
		cin>>n;
		if(isPrime(n))
		{
			cout<<1<<endl<<n<<endl;
			continue;
		}
		ll int ma=0,num,num2;
		for(ll int i=2;i<=sqrt(n);i++)
		{
			ll int k=0,p=n;
			while(p%i==0)
			{
				p=p/i;
				k++;
			}
			if(k>ma)
			{
				ma=k;
				num=i;
				num2=p;
			}
		}
		
		cout<<ma<<endl;
		for(ll int i=1;i<=ma;i++)
		{
			if(i==ma)
			{
				cout<<num2*num<<" ";
			}
			else
			{
				cout<<num<<" ";
			}
		}
		cout<<endl;
	}
}  