def yakusu(n): ans = 0 for i in range(1, int(n ** (1 / 2)) + 1): if n % i == 0: if i != n ** (1 / 2): ans += 2 else: ans += 1 return ans n = int(input()) ans = [] tmp = 10 ** 20 for i in range(1, n // 2 + 1): if tmp > abs(i - yakusu(i) - ((n - i) - yakusu(n - i))): tmp = abs(i - yakusu(i) - ((n - i) - yakusu(n - i))) ans = [(i, n - i)] elif tmp == abs(i - yakusu(i) - ((n - i) - yakusu(n - i))): ans += [(i, n - i)] for i in range(len(ans)): print(ans[i][0], ans[i][1]) for i in range(len(ans) - 1, -1, -1): print(ans[i][1], ans[i][0])