import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); sc.close(); int x2 = x / 2; Eratosthenes er = new Eratosthenes(x); int min = Integer.MAX_VALUE; List list = new ArrayList<>(); for (int i = 1; i <= x2; i++) { int f1 = f(er, i); int f2 = f(er, x - i); int v = Math.abs(f1 - f2); if (v < min) { min = v; list.clear(); list.add(i); } else if (v == min) { list.add(i); } } PrintWriter pw = new PrintWriter(System.out); for (int i = 0; i < list.size(); i++) { pw.println(list.get(i) + " " + (x - list.get(i))); } for (int i = list.size() - 1; i >= 0; i--) { pw.println(x - list.get(i) + " " + list.get(i)); } pw.flush(); } static int f(Eratosthenes er, int n) { if (n == 1) { return 0; } Map soinsu = er.bunkai(n); int d = 1; for (int i : soinsu.values()) { d *= i + 1; } return n - d; } static class Eratosthenes { int[] div; public Eratosthenes(int n) { div = new int[n + 1]; div[0] = -1; div[1] = -1; int end = (int) Math.sqrt(n) + 1; for (int i = 2; i <= end; i++) { if (div[i] == 0) { div[i] = i; for (int j = i * i; j <= n; j+=i) { if (div[j] == 0) div[j] = i; } } } for (int i = end + 1; i <= n; i++) { if (div[i] == 0) div[i] = i; } } public Map bunkai(int x) { Map soinsu = new HashMap<>(); while (x > 1) { Integer d = div[x]; if (soinsu.containsKey(d)) { soinsu.put(d, soinsu.get(d) + 1); } else { soinsu.put(d, 1); } x /= d; } return soinsu; } public boolean isSosuu(int x) { return div[x] == x; } } }