from collections import defaultdict def Sieve_of_Eratosthenes(maxA): lst = [-1]*(maxA+1) lst[0] = 0 lst[1] = 1 for i in range(2, maxA+1): if lst[i] == -1: for g in range(i, maxA+1, i): if lst[g] == -1: lst[g] = i return lst def factorization(n): # 「n = 1」はダメ!!! d = defaultdict(int) now = n while True: if now == lst[now]: if now != 1: d[now] += 1 break r = lst[now] while now % r == 0: now //= r d[r] += 1 ans = 1 for i, m in d.items(): ans *= (m+1) return ans x = int(input()) lst = Sieve_of_Eratosthenes(x) MIN = float("inf") ans_list = [] for i in range(1, x): a = i b = x-i fa = a-factorization(a) fb = b-factorization(b) dif = abs(fa-fb) if MIN > dif: MIN = dif ans_list = [] ans_list.append((a, b)) elif MIN == dif: ans_list.append((a, b)) for a, b in ans_list: print(a, b)