def yinzi(a):
    f = 0
    for j in a:
        for i in range(2, 10):
            if j % i == 0:
                f = 1
                print(i,end=' ')
        if f == 0:
            print('none')
        print()
        


while True:
    try:
        arr = []
        a = int(input())
        if a == -1:
            break
        arr.append(a)
        yinzi(arr)

    except:
        break