#include <bits/stdc++.h>
using namespace std;

#define vi vector<int>
#define ll long long
int main() {
	// your code goes here
    int t;
    cin>>t;
    while (t--)
    {
        ll n;
        cin>>n;
        ll x = n;
        ll c = 0;
        for(ll i = 2;i<=sqrt(n);i++) {
            if(n%i == 0) {
                ll temp = n;

                ll tc = 0;
                while (temp%i == 0)
                {
                    temp /= i;
                    tc++;
                }
                if(tc > c) {
                    x = i;
                    c = tc;
                }
            }
        }
        vector<ll> vec;
        while (true)
        {
            n = n/x;
            if(n%x !=0) {
                vec.push_back(n*x);
                break;
            }
            vec.push_back(x);
        }
        cout<<vec.size()<<"\n";
        for(auto x:vec) cout<<x<<" ";
        cout<<"\n";
    }
	return 0;
}
