#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, x, y, id; cin >> n; vector> a(n); for(int i = 0; i < n; i++){ cin >> x >> y; a[i] = make_tuple(x, y, i); } sort(a.begin(), a.end()); cout << n / 2 << '\n'; for(int i = 0; i + 1 < n; i += 2){ int x, y, id; int x2, y2, id2; tie(x, y, id) = a[i]; tie(x, y, id2) = a[i + 1]; cout << id + 1 << ' ' << id2 + 1 << '\n'; } }