/*
   ╔═══╦═══╦═══╗
   ║╔═╗║╔══╩╗╔╗║
   ║║░║║╚══╗║║║║
   ║║░║║╔══╝║║║║
   ║╚═╝║╚══╦╝╚╝║
   ╚══╗╠═══╩═══╝
   ░░░╚╝░░░░░░░░
*/

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n)

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}



#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<ll> primeFactors(ll n)  {  
    vector<ll> ans;
    while (n % 2 == 0){  
        ans.push_back(2);
        n = n/2;  
    }  

    for (int i = 3; i <= sqrt(n); i = i + 2) {  
        while (n % i == 0) {  
            ans.push_back(i);
            n = n/i;  
        }  
    }  

    if (n > 2)  
        ans.push_back(n);
    return ans;
}  
void solve() {
        ll n;
        cin>>n;
        vector<ll> ans = primeFactors(n);
        ll mx = -1;
        ll p;
        unordered_map<ll,ll> cnt;
        for(int i=0;i<ans.size();i++) {
            cnt[ans[i]]++;
            if(cnt[ans[i]] > mx) {
                    mx = cnt[ans[i]];
                    p = ans[i];
            }
        }
        debug(ans);
        if(mx > 1) {
                cout<<mx<<endl;
                for(int i=0;i<mx-1;i++) cout<<p<<" ";
                cout<<n/(ll)pow(p,mx-1);
                cout<<endl;
        }else {
                cout<<"1"<<endl;
                cout<<n<<endl;
        }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--) {
            solve();
    }
    return 0;
}




