#include <bits/stdc++.h>   using namespace std;   long long n, j, k, a, b;   pair<int, int> c[300005];   map<pair<long long, long long>, long long> m;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a >> b;       c[i] = make_pair(a, b);       m[c[i]] = i;       if (a > b) {         k++;       }     }     sort(c, c + n);     j = n - k;     if (k > j) {       cout << k <<   n ;       for (int i = 0; i < n; i++) {         if (c[i].first > c[i].second) {           cout << m[c[i]] + 1 <<    ;         }       }     } else {       cout << j <<   n ;       for (int i = n - 1; i >= 0; i--) {         if (c[i].first < c[i].second) {           cout << m[c[i]] + 1 <<    ;         }       }     }     cout <<   n ;     return 0;   }   