#include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N; cin >> N; pair, int> A[8010]; for(int i = 0; i < N; i++){ cin >> A[i].first.first >> A[i].first.second; A[i].second = i+1; } sort(A, A+N); cout << N/2 << "\n"; for(int i = 0; i < N/2; i++) cout << A[i*2].second << " " << A[i*2+1].second << "\n"; }