N=int(input()) x=2*(10**6) D=[0]*(2*x+2) for i in range(1,2*x+2): d=i D[i]+=-1+i while d+i<=2*x: d+=i D[d]-=1 A=[] n=x for i in range(1,N): a,b=i,N-i if a>=b: break d=abs(D[a]-D[b]) if n==d: A.append((a,b)) A.append((b,a)) elif n>d: A=[] n=d A.append((a,b)) A.append((b,a)) for a,b in sorted(A): print(a,b)