def seachPrimeNum(N): max = int(N ** 0.5) seachList = [i for i in range(2, N + 1)] primeNum = [] while seachList[0] <= max: primeNum.append(seachList[0]) tmp = seachList[0] seachList = [i for i in seachList if i % tmp != 0] primeNum.extend(seachList) return primeNum def adic(dic, x): if x in dic: dic[x] += 1 else: dic[x] = 1 return def factorization(x): dic = {} for p in PL: if x in PL: adic(dic, x) return dic while x % p == 0: adic(dic, p) x //= p if x == 1: return dic # 約数の数 def N_divisors(x): dic = factorization(x) ret = 1 for v in dic.values(): ret *= (v + 1) return ret X = int(input()) l = max(1, X // 2 - 2000) r = min(X-1,X//2 + 2000) PL = seachPrimeNum(r) L = [] difmin = X mid = X // 2 for A in range(l, X // 2 + 1): B = X - A FA = A - N_divisors(A) FB = B - N_divisors(B) if abs(FA - FB) < difmin: difmin = abs(FA - FB) L = [A] elif abs(FA - FB) == difmin: L.append(A) ans = [] for l in L: if X % 2 == 0 and X // 2 == l: ans.append((l, l)) else: ans.append((l, X - l)) ans.append((X - l, l)) ans.sort() for a in ans: print(*a)