#include #include #include using namespace std; struct d{ int x,y; int i; bool operator<(d z){ if(x == z.x)return y < z.y; return x < z.x; } }; int main(){ int n;cin>>n; vector A(n); for(int i = 0; n > i; i++){ cin>>A[i].x>>A[i].y; A[i].i = i + 1; } sort(A.begin(), A.end()); cout << n/2 << endl; for(int i = 0; n-1 > i; i+=2){ cout << A[i].i << " " << A[i+1].i << endl; } }