use proconio::input; use proconio::fastout; #[fastout] #[allow(non_snake_case)] fn main() { input! { mut X: usize, } assert!(1 <= X && X <= 1_000_000_000_000_000_000); if X == 1 { println!("2"); println!("1 2"); println!("b g"); return; } let n = (X as f64).sqrt() as usize; let mut p = Vec::new(); while X % 4 == 0 { p.push(4); X /= 4; } for i in 2..=n { if i >= 200000 { if X == 1 { break; } println!("-1"); return; } while X % i == 0 { p.push(i); X /= i; } } if X > 1 { p.push(X); } let N = p.len(); let s = p.iter().sum::(); if N + s > 200_000 { println!("-1"); return; } println!("{}", N + s); let mut j = N; for i in 0..N { for _ in 0..p[i] { println!("{} {}", i+1, j+1); j += 1; } if i < N - 1 { println!("{} {}", i+1, i+2); } } println!("{} {}", "b".repeat(N).chars().map(|x| x.to_string()).collect::>().join(" "), "g".repeat(s).chars().map(|x| x.to_string()).collect::>().join(" ")); }