今天有点累了。

import math
while True:
    try:
        a = int(input())
        res = []
        for num in range(2,int(math.sqrt(a)+1)):  #math.sqrt(a)
            while a%num==0:							#while 
                a = a//num
                print(num,end=' ')
        if a>2:
            print(a)
    except:
        break