import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) def ct(n): ret=0 for i in range(1,int(n**0.5)+1): if n%i==0: ret+=1 if i!=n//i: ret+=1 return ret w=200 D=dict() for i in range(max(1,n//2-w),min(n-1,n//2+w)): D[i]=i-ct(i) ans=float("inf") for d in D.keys(): if n-d in D.keys(): ans=min(ans,abs(D[d]-D[n-d])) Ans=[] for d in D.keys(): if n-d in D.keys() and abs(D[d]-D[n-d])==ans: Ans.append((d,n-d)) Ans.sort() for a,b in Ans: print(a,b)