def primeset(N): #N以下の素数をsetで求める.エラトステネスの篩O(√Nlog(N)) lsx = [1]*(N+1) for i in range(2,int(-(-N**0.5//1))+1): if lsx[i] == 1: for j in range(i,N//i+1): lsx[j*i] = 0 setprime = set() for i in range(2,N+1): if lsx[i] == 1: setprime.add(i) return setprime def factorization_all_n(n):#n以下の自然数すべてをを素因数分解 lspn = [[] for i in range(n+1)] lsnum = [i for i in range(n+1)] lsp = list(primeset(n)) lsp.sort() for p in lsp: for j in range(1,n//p+1): cnt = 0 while lsnum[p*j]%p==0: lsnum[p*j] //= p cnt += 1 lspn[j*p].append((p,cnt)) return lspn X = int(input()) n = X lspn = [1 for i in range(n+1)] lsnum = [i for i in range(n+1)] lsp = list(primeset(n)) lsp.sort() for p in lsp: for j in range(1,n//p+1): cnt = 0 while lsnum[p*j]%p==0: lsnum[p*j] //= p cnt += 1 lspn[j*p] *= cnt+1 mind = 10**9 ll = [] for i in range(1,X): a,b = i,X-i if abs((a-lspn[a]) - (b-lspn[b])) < mind : ll = [(a,b)] mind = abs((a-lspn[a]) - (b-lspn[b])) elif abs((a-lspn[a]) - (b-lspn[b])) == mind: ll.append((a,b)) else: continue for a,b in ll: print(a,b)