// WEBLINK #include #include #include #include #include #include using namespace std; using ll = long long; using ii = pair; using iii = pair; using vi = vector; using vvi = vector; using vll = vector; using vii = vector; using viii = vector; #define pb push_back #define fst first #define snd second #define all(x) (x).begin,(x).end() // ---------- MOD -------------------- const int mod = 998244353; void add(int & x, int y) { x += y; if (x < 0) x += mod; if (x >= mod) x -= mod; } int add2(int x, int y) { x += y; if (x < 0) x += mod; if (x >= mod) x -= mod; return x; } int mul(int x, int y) {ll r = x; r *= y; return r % mod;} int power(int x, int p) { if (x < 0 or p < 0) return 0; int r = 1; while (p > 0) { if (p & 1) r = mul(r, x); x = mul(x, x); p /= 2; } return r; } int inv(int a) { return power(a, mod - 2); } templateT amax(T &a, T1 b) {if (b > a)a = b; return a;} templateT amin(T &a, T1 b) {if (b < a)a = b; return a;} // ---------- DEBUG -------------------- //#define ON_PC #ifdef ON_PC #include #else #define deb(x...) #endif /////////////////////////////////// string f() { int x; cin >> x; if (x >= 12 or x < 3) return "winter"; if (x >= 3 and x < 6) return "spring"; if (x >= 6 and x < 9) return "summer"; return "fall"; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; viii A(n); int i = 0; for (auto & x : A) { x.snd = i++; cin >> x.fst.fst; cin >> x.fst.snd; } sort(A.begin(), A.end()); cout << n / 2 << endl; for (int i = 0; i + 1 < n; i += 2) { cout << A[i].second + 1 << " " << A[i + 1].second + 1 << endl; } return 0; }