1.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
* Problem: 10392 - Factoring Large Numbers
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=15&page=show_problem&problem=1333
*
* @author Dennis Wilfert
* @version 1.0, 10/26/2009
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.124
*/

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;


class Main {

public static void main(String...strings) throws NumberFormatException, IOException{

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(new BufferedOutputStream(System.out));

long number = Long.parseLong(reader.readLine());
long j;

while(number!=-1){

// Prüfen ob zweier und dreier Primfaktoren der Zahl sind
while(number%2==0){
number/=2;
writer.println(" 2");
}

while(number%3==0){
number/=3;
writer.println(" 3");
}

// Bei Zahlen größer 3 kann es sich nur bei den Zahlen (k*6)-1 und (k*6)+1 um Primzahlen handeln
j = 5;
while(j<=Math.sqrt(number)){

while(number%j==0){
number/=j;
writer.println(" " + j);
}

j+=2;
while(number%j==0){
number/=j;
writer.println(" " + j);
}

j+=4;
}

if(number>1)
writer.println(" " + number);
writer.println();

number = Long.parseLong(reader.readLine());
}
writer.flush();
}

}