#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i=0; i<(int)(n); ++i)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
   while (t--) {
     ll n;
     cin >> n;
     vector<pair<int, ll>> pd;
     ll o = n;
     for (ll i = 2; i * i <= n; ++i) {
       int cnt = 0;
       while (n%i == 0) {
         ++cnt;
         n /= i;
       }
       pd.emplace_back(cnt, i);
     }
     if (n > 1) {
       pd.emplace_back(1, n);
     }
     sort(pd.rbegin(), pd.rend());
     int l = pd[0].first;
     cout << l << endl;
     rep(i,l-1) {
       cout << pd[0].second << " ";
       o /= pd[0].second;
     }
     cout << o << endl;
   }
}