def f(x): return x - d[x] X = int(input()) d = [0] * (X + 1) for i in range(1, X + 1): for j in range(i, X + 1, i): d[j] += 1 d[0] = 10 ** 18 ans = [] pre = 10 ** 18 for i in range(1, X + 1): v = abs(f(i) - f(X - i)) if v > pre: continue elif v == pre: ans.append(i) else: pre = v ans = [] ans.append(i) for a in ans: print(a, X - a)