#[allow(dead_code)] #[allow(unused_imports)] fn read() -> T { use std::io::*; let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read char") as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().expect("failed to parse token") } fn enum_divisors(n:i64) -> i64 { let mut res = Vec::new(); let mut i = 1; while i * i <= n { if n % i == 0 { res.push(i); if n / i != i { res.push(n/i); } } i += 1; } res.len() as i64 } fn main(){ let x:i64 = read(); let mut ans = 1e18 as i64; let mut rec = Vec::new(); for i in 1..= x / 2 { let a = i - enum_divisors(i); let b = x - i - enum_divisors(x - i); ans = std::cmp::min(ans,(a - b).abs()); } for i in 1..= x/ 2 { let a = i - enum_divisors(i as i64); let b = x - i - enum_divisors(x as i64 - i as i64); if (a - b).abs() == ans { rec.push((i,x - i)); rec.push((x - i,i)); } } rec.sort(); for i in 0..rec.len() { println!("{} {}",rec[i].0, rec[i].1); } }