#include<bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define P pair<ll,ll>
#define F first
#define S second
#define vll vector<ll>
#define vpll vector<P>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define mll map<ll,ll>
#define M map
#define V vector
#define mod2 998244353
#define mod 1000000007
#define C cout<<fixed<<setprecision(5)
using namespace std;
int main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll t;
	cin >> t;
	while (t--){
	   ll n,b;
	   cin>>n; b=n;
	   ll m=0,s,x=sqrt(n);
	   for(ll i=2;i<=x;i++){ ll c=0;
	       if(n==1) break;
	       while(n%i==0&&n>0){
	           c++; n=n/i;
	       }
	       if(c>m) {m=c; s=i;}
	   }
	   if(m==0) {
	       cout<<1<<"\n"; cout<<n<<"\n";
	   }
	   else{ cout<<m<<"\n"; ll k=1;
	       for(ll i=0;i<m-1;i++){
	           cout<<s<<" "; k*=s;
	       }
	       cout<<b/k<<"\n";
	   }
	}
	return 0;
}	