#include "stdafx.h"
#include "iostream"
#include "math.h"
using namespace std;
void get_devices(int);
int main(){
while(1){
int n; cin>>n;
if(n==0)
break;
get_devices(n);}
return 0;
}
void get_devices(int n){
for(int i=2;i<=sqrt((double)n);i++)
if(n%i==0){
cout<<i<<" ";
get_devices(n/i);
return;}
cout<<n<<endl;
}