#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>

using namespace std;
#define ll long long

void calc(long long n){
	ll m = n;
	ll i, num;
	ll maxi = -1, maxx = 1;
	for(i = 2;i <= sqrt(n);i++){
		if(n % i == 0){
			num = 0;
			while(n % i == 0) num++, n /= i;
			if(num >= maxx){
				maxx = num;
				maxi = i;
			}
		}
	}
	if(n > 1){
		if(maxx == 1){
			maxi = n;
			maxx = 1;
		}
	}
	printf("%lld\n", maxx);
	for(i = 1;i < maxx;i++){
		printf("%lld ", maxi);
		m /= maxi;
	}
	printf("%lld\n", m);
}

int main(){
	int T;
	ll n;
	scanf("%d", &T);
	while(T--){
		scanf("%lld", &n);
		calc(n);
	}
	return 0;
}