// #pragma GCC target("avx2") #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") #include // #include // #include using namespace std; // using mint = atcoder::modint998244353; const int M = 998244353; const long long LM = 1LL << 60; using P = pair; int main() { cin.tie(0); ios::sync_with_stdio(0); int n; cin >> n; vector a(n), b(n); for (int i = 0; i < n; ++i) { cin >> a[i] >> b[i]; } long long T = 500000000000000000LL; auto calc = [&](int i, int j) { return max(abs(a[i] + a[j] - T * 2), abs(b[i] + b[j] - T * 2)); }; vector

ans; auto op = [&](int i, int j) { if (i == j) return; if (ans.size() >= 50) return; ans.emplace_back(i, j); auto av = (a[i] + a[j]) / 2; auto bv = (b[i] + b[j]) / 2; a[i] = av; a[j] = av; b[i] = bv; b[j] = bv; }; // auto calc2 = [&](int i, int j) { // return abs(a[i] + a[j] - T * 2) + abs(b[i] + b[j] - T * 2); // }; while (ans.size() < 40) { int p = -1, q = -1; for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { if (calc(i, j) < calc(i, i) && calc(i, j) < calc(j, j)) { if (p == -1 || calc(i, j) < calc(p, q)) { p = i; q = j; } } } } if (p == -1) break; op(p, q); } auto greedy = [&]() { while (ans.size() < 50) { int q = 0; for (int i = 1; i < n; ++i) { if (calc(0, q) > calc(0, i)) { q = i; } } if (q == 0) break; op(0, q); } }; auto orig_a = a; auto orig_b = b; auto orig_ans = ans; greedy(); auto best_ans = ans; auto best_score = calc(0, 0); for (int i = 1; i < n; ++i) { a = orig_a; b = orig_b; ans = orig_ans; op(0, i); greedy(); if (best_score > calc(0, 0)) { best_ans = ans; best_score = calc(0, 0); } } for (int i = 1; i < n; ++i) { for (int j = 1; j < n; ++j) { if (i == j) continue; a = orig_a; b = orig_b; ans = orig_ans; op(0, i); op(0, j); greedy(); if (best_score > calc(0, 0)) { best_ans = ans; best_score = calc(0, 0); } } } for (int i = 1; i < n; ++i) { for (int j = 1; j < n; ++j) { if (i == j) continue; for (int k = 1; k < n; ++k) { if (i == k || j == k) continue; a = orig_a; b = orig_b; ans = orig_ans; op(0, i); op(0, j); op(0, k); greedy(); if (best_score > calc(0, 0)) { best_ans = ans; best_score = calc(0, 0); } } } } ans = best_ans; cerr << best_score / 2 << '\n'; if (ans.size() > 50) { ans.resize(50); } cout << ans.size() << '\n'; for (auto& i : ans) { cout << i.first + 1 << ' ' << i.second + 1 << '\n'; } return 0; }