// ---------- begin input macro ---------- // reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s = { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); s }; let mut iter = s.split_whitespace(); input_inner!{iter, $($r)*} }; } macro_rules! input_inner { ($iter:expr) => {}; ($iter:expr, ) => {}; ($iter:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($iter, $t); input_inner!{$iter $($r)*} }; } macro_rules! read_value { ($iter:expr, ( $($t:tt),* )) => { ( $(read_value!($iter, $t)),* ) }; ($iter:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($iter, $t)).collect::>() }; ($iter:expr, chars) => { read_value!($iter, String).chars().collect::>() }; ($iter:expr, bytes) => { read_value!($iter, String).bytes().collect::>() }; ($iter:expr, usize1) => { read_value!($iter, usize) - 1 }; ($iter:expr, $t:ty) => { $iter.next().unwrap().parse::<$t>().expect("Parse error") }; } // ---------- end input macro ---------- use std::io::Write; use std::collections::*; type Map = BTreeMap; type Set = BTreeSet; type Deque = VecDeque; fn run() { input! { a: usize, } let mut v = 1; let mut gen = || { let res = v; v += 1; res }; let src = 0; let mut e = vec![]; let mut x = vec![]; let mut y = vec![]; let mut z = vec![]; for i in 1..=39 { x.push(gen()); y.push(gen()); z.push(gen()); } let dst = z[z.len() - 1]; e.push((src, x[0])); e.push((src, y[0])); for i in 1..x.len() { e.push((x[i - 1], x[i])); e.push((x[i - 1], y[i])); e.push((y[i - 1], x[i])); e.push((y[i - 1], y[i])); e.push((z[i - 1], z[i])); } for i in 0..40 { if a >> i & 1 == 1 { e.push((x[i], z[i])); } } println!("{} {}", dst + 1, e.len()); for (a, b) in e { println!("{} {}", a + 1, b + 1); } } fn main() { run(); }