#include using namespace std; #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 1 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector> a(n); for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } vector idx(n); iota(idx.begin(), idx.end(), 0); sort(idx.begin(), idx.end(), [&] (int i, int j) { return a[i] < a[j]; }); cout << n / 2 << '\n'; for (int i = 0; i < n / 2; i++) { cout << idx[2 * i] + 1 << ' ' << idx[2 * i + 1] + 1 << '\n'; } }