#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define f(i,q,n) for(int i=(int)q;i<n;i++)
#define pb push_back
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    cin>>t;
    while(t--){
    ll n;
    cin>>n;
    ll mi=1,ans=n;
    int flag=0; 
for(ll i=2;i*i<=n;i++){
if(n%i==0){flag=1; break;}

}
if(flag==0){
    cout<<1<<endl<<n<<endl; continue;
}

for(ll i=2;i*i<=n;i++){
int count=0;
ll x=n;
if(n%i==0){
while(x%i==0){
x/=i;
count++;
//cout<<x<<" "<<count<<" ";
}
}
//cout<<count<<" ";
if(count>mi){
ans=i; mi=count;
}

}
cout<<mi<<endl;
mi--;
while(mi--){
    cout<<ans<<" ";
    n/=ans;
}
cout<<n<<endl;



}
    return 0;
}