use std::cmp::{max, min}; use std::io; fn main() { let mut buffer = String::new(); io::stdin().read_line(&mut buffer).unwrap(); let n: usize = buffer.trim().parse().unwrap(); let mut cards = vec![]; for _ in 0..n { let mut buffer = String::new(); io::stdin().read_line(&mut buffer).unwrap(); let mut iter = buffer.trim().split_whitespace(); let x: i64 = iter.next().unwrap().parse().unwrap(); let y: i64 = iter.next().unwrap().parse().unwrap(); cards.push((x, y)); } let target = 10_i64.pow(17) * 5; let mut ans = vec![]; for i in 0..50 { let mut cur_diff = max((cards[0].0 - target).abs(), (cards[0].1 - target).abs()); let mut tmp = (n, n); for p in 1..n { let new_card_0 = ((cards[p].0 + cards[0].0) / 2, (cards[p].1 + cards[0].1) / 2); let new_diff = max((new_card_0.0 - target).abs(), (new_card_0.1 - target).abs()); if new_diff < cur_diff { cur_diff = new_diff; tmp = (0, p); } } if i < 49 { for p in 1..n { for q in p + 1..n { let new_card = ((cards[p].0 + cards[q].0) / 2, (cards[p].1 + cards[q].1) / 2); let new_card_0 = ((cards[0].0 + new_card.0) / 2, (cards[0].1 + new_card.1) / 2); let new_diff = max((new_card_0.0 - target).abs(), (new_card_0.1 - target).abs()); if new_diff < cur_diff { cur_diff = new_diff; tmp = (p, q); } } } } if tmp == (n, n) { break; } let new_card = ((cards[tmp.0].0 + cards[tmp.1].0) / 2, (cards[tmp.0].1 + cards[tmp.1].1) / 2); cards[tmp.0] = new_card; cards[tmp.1] = new_card; ans.push(tmp); } println!("{}", ans.len()); for a in ans { println!("{} {}", a.0 + 1, a.1 + 1); } // eprintln!("{:?}", cards); }