// C++ program to print all prime factors
#include <bits/stdc++.h>
#define int long long int
using namespace std;

// A function to print all prime
// factors of a given number n
vector<int> primeFactors(int n)
{
    // Print the number of 2s that divide n
    vector<int> v;
    while (n % 2 == 0)
    {
        // cout << 2 << " ";
        v.push_back(2);
        n = n / 2;
    }

    // n must be odd at this point. So we can skip
    // one element (Note i = i +2)
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        // While i divides n, print i and divide n
        while (n % i == 0)
        {
            // cout << i << " ";
            v.push_back(i);
            n = n / i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        // cout << n << " ";
        v.push_back(n);
    return v;
}

/* Driver code */
int32_t main()
{
    // int n = 10000000000;
    // primeFactors(n);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<int> v = primeFactors(n);
        map<int, int> mp;
        int occur = -1;
        int num = n;
        for (int i = 0; i < v.size(); i++)
        {
            mp[v[i]]++;
            if (mp[v[i]] > occur)
            {
                occur = mp[v[i]];
                num = v[i];
            }
        }
        cout<<occur<<"\n";
        for (int i = 0; i < occur - 1; i++)
        {
            cout << num << " ";
            n /= num;
        }
        cout << n << "\n";
    }

    return 0;
}

// This is code is contributed by rathbhupendra
