/*Jot down observation and conditions/constraints
List possible base cases(DP?) and edge cases
Maths
Probe with aim
Brute
two pointer
DS
choices?-DP/recursion
Don't get intimidated
Odd-even Binary Modulo Min Max in Adhoc
In games find losing position and analyse thereon
Write cleaner codes*/

#include <bits/stdc++.h>

using namespace std;


//long long ind[200005];

int main()
{
    long long t,i,n,ans,mn,mx,num,val,res;
    map<long long,long long> mp;
    cin>>t;
    while(t--)
    {
        cin>>n;res=n;
        val=1;mx=0;
        for(i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                while(n%i==0)
                {
                    n/=i;
                    mp[i]++;
                    if(mp[i]>mx){mx=mp[i];val=i;}
                }
            }
        }
        if(n>1)
        {
            mp[n]++;if(mp[n]>mx){mx=mp[n];val=n;}
        }
        cout<<mx<<"\n";num=1;
        for(i=0;i<mx-1;i++)
        {
            cout<<val<<" ";
            num*=val;
        }
        mp.clear();
        cout<<res/num<<"\n";
    }


    return 0;
}