#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n;
while(n--){
int x;
cin>>x;
while(x!=1){
for(int i=2;;i++){
if(x%i==0){
cout<<i<<" ";
x/=i;
break;
}
}
}
cout<<"\n";
}
return 0;
}