maxn = 2 * 10 ** 6 + 3 d = [0] * maxn mpc = [0] * maxn p = [] pv = [False] * maxn d[1] = 1 for i in range(2, maxn): if not pv[i]: p.append(i) d[i] = 2 mpc[i] = 1 for j in p: if i * j >= maxn: break if i % j == 0: pv[i * j] = True mpc[i * j] = mpc[i] + 1 d[i * j] = d[i] // mpc[i * j] * (mpc[i * j] + 1) break else: pv[i * j] = True mpc[i * j] = 1 d[i * j] = 2 * d[i] f = lambda n: n - d[n] x = int(input()) ans = 10 ** 18 al = [] for i in range(1, x): a, b = i, x - i c = abs(f(a) - f(b)) if c < ans: ans = c al = [(a, b)] elif c == ans: al.append((a, b)) for a, b in al: print(a, b)