#include using namespace std; int main() { // step #1. input int N; cin >> N; vector A(N), B(N); for (int i = 0; i < N; i++) { cin >> A[i] >> B[i]; A[i] -= 5.0e+17; B[i] -= 5.0e+17; } // step #2. greedy double bestscore = 1.0e+99; vector bestdepth; for (int i = 0; i < N; i++) { vector depth(N, -1); depth[i] = 1; double x = A[i] * 0.5; double y = B[i] * 0.5; for (int j = 2; j <= N; j++) { double mul = pow(0.5, min(j, N - 1)); double subbest = 1.0e+99; int subpos = -1; for (int k = 0; k < N; k++) { if (depth[k] == -1) { double nx = x + A[k] * mul; double ny = y + B[k] * mul; if (subbest > max(abs(nx), abs(ny))) { subbest = max(abs(nx), abs(ny)); subpos = k; } } } depth[subpos] = min(j, N - 1); x += A[subpos] * mul; y += B[subpos] * mul; } if (bestscore > max(abs(x), abs(y))) { bestscore = max(abs(x), abs(y)); bestdepth = depth; } } // step #3. construction vector > answer; vector curdepth = bestdepth; while (curdepth[0] != 0) { int p1 = max_element(curdepth.begin(), curdepth.end()) - curdepth.begin(); int p2 = max_element(curdepth.begin() + p1 + 1, curdepth.end()) - curdepth.begin(); answer.push_back({p1, p2}); curdepth[p1] -= 1; curdepth[p2] = -1; } // step #4. output cout << answer.size() << endl; for (array v : answer) { cout << v[0] + 1 << ' ' << v[1] + 1 << endl; } return 0; }