#include using namespace std; #define int ll #define fast_io cin.tie(0)->sync_with_stdio(0); #define endl '\n' typedef long long ll; int32_t main() { fast_io; int n; cin >> n; vector> a(n); for (auto &[x, y] : a) cin >> x >> y; vector ord(n); iota(ord.begin(), ord.end(), 0); sort(ord.begin(), ord.end(), [&] (int i, int j) { return a[i] < a[j]; }); cout << n/2 << endl; for (int i = 0; i + 1 < n; i += 2) { cout << ord[i]+1 << " " << ord[i+1]+1 << endl; } }