//Created by:Coding_lover(11/25/2020, 12:25:56 PM)
#include <bits/stdc++.h>
#define ll long long
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define INF LLONG_MAX
#define MOD 1000000007
#define f first
#define s second
#define LB lower_bound
#define UB upper_bound
#define gcd(a,b)  __gcd((a),(b))
#define lcm(a,b)  ((a)*(b)) / gcd((a),(b))
#define pi pair<long long,long long>
#define pii pair<long long,pi>
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(v) (ll)v.size()
#define vc vector
#define vll vector<long long>
#define rep(i, a, n) for (ll i = a; i < (long long)n; ++i)
#define repe(i, a, n) for (ll i = a; i <= (long long)n; ++i)
#define repr(i, n, a) for (ll i = n; i > (long long)a; --i)
#define repre(i, n, a) for (ll i = n; i >= (long long)a; --i)
#define dbg(x) cout<<"Debugging "<<#x<<":"<<endl;cout<<#x<<" = "<<x<<endl
#define dbgv(v) cout<<"Debugging "<<#v<<":"<<endl; for(ll i=0;i<v.size();i++){cout<<v[i]<<" ";}cout<<endl;
using namespace std;
ll gcdExtended(ll a, ll b, ll &x, ll &y)
{
	if (a == 0)
	{
		x = 0, y = 1;
		return b;
	}
	ll x1, y1;
	ll gcd = gcdExtended(b%a, a, x1, y1);
	x = y1 - (b/a) * x1;
	y = x1;
	return gcd;
}
ll modInverse(ll a, ll m)
{
	ll x, y,res;
	ll g = gcdExtended(a, m, x, y);
	if (g != 1) return INF;
	else res = (x%m + m) % m;
	return res;
}
int main() {
  FASTER;
  ll test;
  cin >> test;
  while (test--) {
	  ll n;
	  cin>>n;
	  ll m=n,maxn=0,maxf=0;
	  while(n%2==0){
		  n/=2;
		  maxf++;
	  }
	  maxn=2;
	  for(ll i=3;i*i<=n;i+=2){
		  ll freq=0;
		  while(n%i==0){
			  n/=i;
			  freq++;
		  }
		  if(freq>maxf){
			  maxf=freq;
			  maxn=i;
		  }
	  }
	  if(maxf==1 or maxf==0){
		  cout<<"1"<<endl;
		  cout<<m<<endl;
	  }
	  else{
		  ll div=pow(maxn,maxf);
		  ll rem=m/div;
		  rem*=maxn;
		  maxf--;
		  cout<<maxf+1<<endl;
		  for(ll i=1;i<=maxf;i++)cout<<maxn<<" ";
		  cout<<rem<<endl;
	  }
  }
  return 0;
}
