//#pragma GCC target ("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <ext/rope>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;

#define files(fin, fout) freopen(fin, "r", stdin); freopen(fout, "w", stdout)
#define foru(i, n) for(int i = 0; i < n; ++i)
#define fori(i, j, n) for(int i = j; i < n; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define mpm(a, b) make_pair(min(a, b), max(a, b))
#define mpint(a, b) ((ll)(a) * (INT_MAX) + (b))
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define mbort(a) sort(all(a))
#define cinm(a) for(auto &i : a) cin >> i
#define sz(a) (int)(a).size()
#define coutm(a) for(auto &i : a) cout << i << ' '; cout << '\n'
#define debug(x) cout << #x << ": " << x << '\n'
#define debugm(x) cout << #x << ":\n"; coutm(x)
#define ff first
#define ss second

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const signed inf = 1000000100;
const ll inf64 = 1ll * inf * inf;
const ll mod = 1e9 + 7;

mt19937 rng(0);

#define int long long

//typedef tree<string, null_type, less_equal<string>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void run() {
    int n;
    cin >> n;
    vector <int> ans;
    map <int, int> cnt;
    for(int i = 2; i * i <= n; ++i){
        while(n % i == 0){
            cnt[i]++;
            n /= i;
        }
    }
    if(n != 1)
        cnt[n]++;
    int mx = 0;
    for(auto i : cnt){
        if(i.ss == 0)
            continue;
        if(i.ss > cnt[mx]){
            mx = i.ff;
        }
    }
    ans.resize(cnt[mx]);
    for(int i = 0; i < cnt[mx] - 1; ++i){
        ans[i] = mx;
    }
    ans[ans.size() - 1] = mx;
    for(auto i : cnt){
        if(i.ff == mx)
            continue;
        if(i.ff == 0)
            continue;
        for(int j = 0; j < i.ss; ++j){
            ans[ans.size() - 1] *= i.ff;
        }
    }
    cout << ans.size() << '\n';
    coutm(ans);
}

signed main(){
    //files("input.txt", "output.txt");
    //files("spiral.in", "spiral.out");
    iostream::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    cin >> t;
    while(t--){
        run();
        cout.flush();
    }
}
