from math import sqrt,floor N = int(input()) l = [0 for _ in range(N+1)] ans = [] num = 10**9 for i in range(1,N+1): for j in range(i,N,i): l[j] += 1 for i in range(N//2-(floor(sqrt(N))+1), N//2+floor(sqrt(N))+1): num = min(num,abs((i-l[i])-(N-i-l[N-i]))) for i in range(N//2-(floor(sqrt(N))+1), N//2+floor(sqrt(N))+1): if num == abs((i-l[i])-(N-i-l[N-i])): ans.append((i,N-i)) for i,j in ans: print(i,j)