# phần này để đọc int khi file input của giám khảo có white space
def does_contain_digits(inp):
    if len(inp) == 0:
        return False
    for c in inp:
        if '0' <= c and c <= '9':
            return True
    return False
while True:
    inp = input()
    #print(len(inp))
    if does_contain_digits(inp):
        p = 0
        for c in inp:
            if '0' <= c and c <= '9':
                p = p * 10 + int(c)
        break

# thuật toán bắt đầu từ đây:
x = 1
y = 1
current_product = 1

MAX = 100000
while y <= MAX:
    current_product *= y
    while current_product > p:
        current_product //= x
        x += 1
    if current_product == p:
        print(x, y)
        break
    y += 1