import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 1; i < n; i++) { arr[i] += i - 1; for (int j = 1; j * i < n; j++) { arr[i * j]--; } } ArrayList mins = new ArrayList<>(); int min = Integer.MAX_VALUE; for (int i = 1; i < n; i++) { int x = Math.abs(arr[i] - arr[n - i]); if (min == x) { mins.add(i); } else if (min > x) { min = x; mins.clear(); mins.add(i); } } StringBuilder sb = new StringBuilder(); for (int x : mins) { sb.append(x).append(" ").append(n - x).append("\n"); } System.out.print(sb); } }