use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: i64 = itr.next().unwrap().parse().unwrap(); let mut d = vec![0i64; n as usize + 2]; d[1] = 1; let mut range = n / 2 - 1; if n > 10000 { range = 1000; } for m in n / 2 - range..n / 2 + 1 { // mの約数の個数 let mut i = 1; let c = &mut d[m as usize]; *c += m; while i * i <= m { if m % i == 0 { if m / i == m / (m / i) { *c -= 1; } else { *c -= 2; } } i += 1; } // n - mの約数 let mut i = 1; let c = &mut d[(n - m) as usize]; *c += n - m; while i * i <= m { if (n - m) % i == 0 { if (n - m) / i == (n - m) / ((n - m) / i) { *c -= 1; } else { *c -= 2; } } i += 1; } } let mut min = 1 << 30; for i in n / 2 - range..n / 2 + 1 { min = std::cmp::min(min, (d[(n - i) as usize] - d[i as usize]).abs()); } let mut ans = Vec::new(); for i in n / 2 - range..n / 2 + 1 { if (d[(n - i) as usize] - d[i as usize]).abs() == min { ans.push((i, n - i)); if i != n - i { ans.push((n - i, i)); } } } ans.sort(); let mut out = Vec::new(); for &i in ans.iter() { writeln!(out, "{} {}", i.0, i.1).ok(); } stdout().write_all(&out).unwrap(); }