#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll l, r;
ll d;
int main(){

    int t;
    cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        ll ans = 1;
        int k = 1;
        for(ll i = 2; i * i <= n; i++){
            ll N = n;
            int cnt = 0;
            while(N % i == 0 && (N / i) % i == 0){
                cnt++;
                if(cnt >= k){
                    ans = i;
                    k = cnt;
                }
                N = N / i;
            }
        }
        if(ans == 1){
            cout << "1" << endl << n << endl;
            continue;
        }
        cout << k + 1 << endl;
        for(int i = 1; i <= k; i++){
            cout << ans << " ";
            n = n / ans;
        }
        cout << n << endl;
    }
    
}