def f(n): l=[] for i in range(2,int(n**0.5)+1): if n%i==0: cnt=0 while n%i==0: cnt+=1 n//=i l.append((i,cnt)) ans=1 if n>1: l.append((n,1)) for k in l: ans*=(k[1]+1) return ans x=int(input()) e=[[] for i in range(10**7+1)] q=10**7+2 for i in range(max(1,int(x**0.5)-100),min(x,int(x*0.5)+100)): 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])