#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
int main()
{    
    #ifndef ONLINE_JUDGE
    freopen("D:/Sublime/Rough/input.txt","r",stdin);
    //freopen("D:/Sublime/Rough/output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(NULL);    
    //std::cout << std::fixed;
    //std::cout << std::setprecision(6);

    int testcase;
    cin>>testcase;
    while(testcase--)
    {
        ll n;
        cin>>n;
        ll org = n;
        unordered_map<ll,int> m;
        ll p = 2;
        while(n>1 && p <= sqrt(org))
        {   
            while(n%p == 0)
            {
                n/=p;
                m[p]++;
            }
            p++;
        }
        if(n>1)
            m[n]++;
        ll ele = -1, val = 0;
        for(auto i : m)
        {
            if(i.second > val)
            {
                val = i.second;
                ele = i.first;
            }
        }
        cout<<val<<"\n";
        p = 1;
        for(int i=1;i<val;i++)
            cout<<ele<<" ", p*=ele;

        cout<<(org/p)<<"\n";
        
    }

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
    #endif
    return 0;
}