# Xまでの約数全列挙をしていて間に合うのだろうか # 約数個数def def divisor_count(n): count = 0 i = 1 while i*i <= n: if n % i == 0: count += 1 if i != n // i: count += 1 i += 1 return count X = int(input()) div_count = [0]*(X+1) for i in range(1, X+1): div_count[i] = divisor_count(i) mn = 10**10 mn_list = [] for a in range(1, X): b = X - a calc = abs(a - div_count[a] - b + div_count[b]) if calc < mn: mn = calc mn_list = [] mn_list.append((a, b)) elif calc == mn: mn_list.append((a, b)) #print(mn_list) for a, b in mn_list: print(a, b)