#include <bits/stdc++.h>
using namespace std;
 #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
 #define pb push_back
 #define test1 cin>>x; while(x--)
 #define inputarr cin>>n; int arr[n]; for(int i=0;i<n;i++)
 #define all(x) x.begin(),x.end()
 #define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
 #define rep(i,a,b) for(int i = a; i < b; i++)
 #define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;   
#define BLOCK 555
#define MAX 3000
 ll cnt,val;
int main(){
      ll x;
      test1{
         ll x;
		cin>>x;
		ll ans=x;
		ll num=1;
		ll n=x;
		for(ll i=2;i<=sqrt(x);i++){
			int now=0;
			while(x%i==0){
				x/=i;
				now++;
			}
			if(now>num){
				num=now;
				ans=i;
			}
		}
		if(ans==x){
			cout<<1<<endl;
			cout<<x<<endl;
		}else{
			cout<<num<<endl;
			for(int i=0;i<num-1;i++){
				n/=ans;
				cout<<ans<<' ';
			}
			cout<<n<<endl;
		}
      }
}