import itertools import numpy as np X = int(input()) #それぞれの約数の個数 yakusu = np.array([2]*(X+1)) yakusu[0] = 0 yakusu[1] = 1 for i in range(2,X//2+1): yakusu[2*i::i] += 1 fn = np.array([0]*(X+1)) for i in range(1,X+1): fn[i] = i - yakusu[i] #print(yakusu[1:X+1]) #print(fn[1:X+1]) minimum = float('inf') for u in range(1,X//2+1): v = X-u tmp = abs(fn[u]-fn[v]) #print(u,v,tmp) if tmp < minimum: ans = {} ans[tmp] = [(u,v)] minimum = tmp elif tmp == minimum: ans[tmp].append((u,v)) for r in ans[minimum]: u, v = r print(u, v) for r in ans[minimum][::-1]: u, v = r print(v,u)