import java.io.BufferedReader import java.io.InputStream import java.io.InputStreamReader import java.lang.StringBuilder import java.util.* fun main(args: Array) { val sc = FastScanner(System.`in`) val x = sc.nextInt() val count = Array(x) { 0 } for (n in 1 until x) { var d = 1 while (d * d <= n) { if (n % d == 0) { if (d * d != n) { count[n] += 2 } else { count[n] += 1 } } d++ } } var min = Int.MAX_VALUE val ans = mutableListOf>() for (a in 1..x / 2) { val b = x - a val v = Math.abs((a - count[a]) - (b - count[b])) if (min > v) { min = v ans.clear() } if (min == v) { ans.add(a to b) ans.add(b to a) } } ans.sortBy { it.first } val sb = StringBuilder() for (item in ans) { sb.appendln("%d %d".format(item.first, item.second)) } println(sb.toString()) } class FastScanner(s: InputStream) { private var st = StringTokenizer("") private val br = BufferedReader(InputStreamReader(s)) fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() fun ready() = br.ready() }