#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define mp make_pair
#define f first
#define s second

#define pb push_back

#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)


#define SIZE 100001

vector<long long> primes;
bool isPrime[SIZE + 1];

void sieve() {
    FOR(i, 2, SIZE) {
        if(isPrime[i] == true) {
            primes.pb(i);
            for(long long j = (long long)i * i; j < SIZE ; j += i) isPrime[j] = false;
        }
    }
}


int main() {
    FOR(i, 1, SIZE) isPrime[i] = true;
    sieve();
    ios_base::sync_with_stdio(false);
    int t; cin >> t;
    while(t --) {
        long long n; cin >> n;
        long long temp = n;
        int maxNum = 0;
        long long num = 0;
        for(int i=0;i<primes.size();i++) {
            int cnt = 0;
            while(n % primes[i] == 0) {
                cnt ++;
                n /= primes[i];
            }
            
            if(maxNum < cnt) {
                maxNum = cnt;
                num = primes[i];
            }
        }
        
        if(n > 1) {
            if(maxNum < 1) {
                maxNum = 1;
                num = n;
            }
        }
        
        cout << maxNum << endl;
        for(int i=0;i<maxNum - 1;i ++) {
            cout << num << " ";
            temp /= num;
        }
        cout << temp << endl;
    }
    return 0;
}
