# X<2*10**6と小さいので全探索して間に合うのでは X = int(input()) count = [0]*(X+1) def divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] for x in range(1, X+1): calc = len(divisors(x)) count[x] = calc ans_list = [] mn = 10**10 for i in range(1, X): j = X-i if i > j: break calc = abs(i-count[i]-j+count[j]) #print('i', i, 'j', j, 'calc', calc) if calc < mn: mn = calc if i != j: ans_list = [(i, j), (j, i)] else: ans_list = [(i, j)] elif calc == mn: if i != j: ans_list.append((i, j)) ans_list.append((j, i)) else: ans_list.append((i, j)) ans_list.sort() #print(mn) #print(ans_list) for i, j in ans_list: print(i, j)