U = 2 * 10 ** 6 div = [1] * (U + 1) for i in range(2, U + 1): div[i] += 1 v = i * 2 while v <= U: div[v] += 1 v += i X = int(input()) a = X // 2 b = X - a score = [] for _ in range(1000): fa = a - div[a] fb = b - div[b] score.append((abs(fa - fb), a)) if a != b: score.append((abs(fa - fb), b)) a -= 1 b += 1 if a <= 0 or b > X: break score.sort() mn = score[0][0] for s, a in score: if s != mn: break print(a, X - a)