#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll>pll;

const int mod = 1e9 + 7;

int maxiK;
int factor;

void primeFactorization(ll n) {
	// cout << "Here" << endl;
	vector<pll>val;
	maxiK = 1;
	factor = n;
	for (ll i = 2; i * i <= n; ++i) {
		// cout << "HEE" << i << endl;
		int cnt = 0;
		while (n % i == 0) {
			++cnt;
			n /= i;
		}
		if(cnt > maxiK){
			maxiK = cnt;
			factor = i;
		}
		// cout << i << " " << cnt << endl;
	}
} 

int main() {
	int t;
	cin >> t;
	while(t--){
		ll n;
		cin >> n;
		maxiK = 1;
		primeFactorization(n);
		cout << maxiK << endl;
		for(int i = 0; i < maxiK - 1; i++){
			cout << factor << " ";
			n /= factor;
		}
		cout << n << endl;
	}
    return 0;
}