#include <bits/stdc++.h>   using namespace std;   int main() {     static int n;     static int a[300010], b[300010];     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d%d , &a[i], &b[i]);     int cnt[2] = {};     for (int i = 1; i <= n; i++) {       if (a[i] < b[i])         cnt[0]++;       else         cnt[1]++;     }     if (cnt[0] > cnt[1]) {       vector<pair<int, int> > vec;       for (int i = 1; i <= n; i++) {         if (a[i] < b[i]) vec.push_back(pair<int, int>(-a[i], i));       }       sort(vec.begin(), vec.end());       printf( %d n , cnt[0]);       for (int i = 0; i < vec.size(); i++) {         printf( %d%c , vec[i].second, (i + 1 == vec.size()) ?   n  :    );       }     } else {       vector<pair<int, int> > vec;       for (int i = 1; i <= n; i++) {         if (a[i] > b[i]) vec.push_back(pair<int, int>(b[i], i));       }       sort(vec.begin(), vec.end());       printf( %d n , cnt[1]);       for (int i = 0; i < vec.size(); i++) {         printf( %d%c , vec[i].second, (i + 1 == vec.size()) ?   n  :    );       }     }   }   