#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
typedef long long ll;
const ll mod = 1e9+7;
const ll inf = 0x3f3f3f3f;
ll n;
int vis[N];
int prime[N];
void get_prime() {
    for (int i = 2; i < N; i++) {
        if (!vis[i])prime[++prime[0]] = i;
        for (int j = 1; j <= prime[0] && i * prime[j] < N; j++) {
            vis[i * prime[j]] = 1;
            if (i % prime[j] == 0)break;
        }
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t;
    cin >> t;
    get_prime();
    while (t--) {
        cin >> n;
        int k = 0, ans = 0;
        ll temp = n;
        for (int i = 1; i <= prime[0]; i++) {
            if (temp == 1)break;
            if (temp % prime[i] == 0) {
                int p = 0;
                while (temp % prime[i] == 0) {
                    p++;
                    temp /= prime[i];
                }
                if (k < p) {
                    k = p;
                    ans = prime[i];
                }
            }
        }
        if (k == 0 || k == 1) {
            cout << 1 << endl << n << endl;
        } else {
            cout << k << endl;
            for (int i = 1; i < k; i++) {
                cout << ans << " ";
                n /= ans;
            }
            cout << n << endl;
        }
    }
    return 0;
}