n = int(input())
list = [2, 3, 7]
flag = 0
for i in list:
if n % i == 0:
print(i, end = " ")
flag = 1
if flag == 0:
print("n")
n = int(input())
list = [2, 3, 7]
flag = 0
for i in list:
if n % i == 0:
print(i, end = " ")
flag = 1
if flag == 0:
print("n")