#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
void divide(LL n)
{
for(int t=2;t<=n/t;t++)
if(n%t==0)
{
int s=0;
while(n%t==0)
{
n/=t;
s++;
}
for(int i=1;i<=s;i++)
printf("%d ",t);
}
if(n>1) printf("%d",n);
cout << endl;
}
int T;
LL n;
int main()
{
cin>>T;
for(int t=1;t<=T;t++)
{
cin>>n;
divide(n);
}
return 0;
}