def f(n): m=n l=[] for i in range(2,n): if n%i==0: cnt=0 while n%i==0: cnt+=1 n//=i l.append((i,cnt)) ans=1 if len(l)==0: l.append((n,1)) for k in l: ans*=(k[1]+1) return ans x=int(input()) e=[[] for i in range(10**6+1)] q=10**6+2 for i in range(max(1,x//2-1000),min(x,x//2+1000)): r=abs(i-f(i)-(x-i)+f(x-i)) e[r].append((i,x-i)) q=min(q,r) for j in e[q]: print(j[0],j[1])