#include <bits/stdc++.h>
#pragma GCC optimize ("O3", "unroll-all-loops")
#pragma GCC target ("sse4.2")

using namespace std;

#define F first
#define S second
typedef long long       ll;
typedef long double     ld;
typedef pair<ll, ll>   pll; 
typedef pair<int, int> pii; 

ifstream in;
ofstream out;

const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = ml * kk + 7;
const long long inf = ml * ml * ml + 7; 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll n;
vector<ll> v;
bool viv = false;


void solve() {
	cin >> n;
	ll sq = sqrt(n) + 10;
	unordered_map<ll, ll> cnt;
	ll fn = n;
	for (int i = 2; i < sq; i++) {
		while (!(fn % i))
			fn /= i, cnt[i]++;
	}
	if (fn - 1)
		cnt[fn]++;
	vector<pll> tos;
	for (auto p : cnt)
		tos.push_back({p.S, p.F});
	sort(tos.rbegin(), tos.rend());
	fn = n;
	cout << tos[0].F << '\n';
	for (int i = 0; i < tos[0].F - 1; i++) {
		cout << tos[0].S << ' ';
		fn /= tos[0].S;
	}
	cout << fn << '\n';
}

int main() {
	// viv = true;
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll t = 1; 
	cin >> t;
	while (t--)
		solve();

	return 0;
}