#include using namespace std; using dog = tuple; int main() { int n; cin >> n; vector dogs; for(int i = 1, x, y; i <= n; i ++) { cin >> x >> y; dogs.push_back({x, y, i}); } sort(dogs.begin(), dogs.end()); cout << n / 2 << "\n"; for(int i = 1; i < n; i += 2) { cout << get<2>(dogs[i - 1]) << " " << get<2>(dogs[i]) << "\n"; } }