#include <bits/stdc++.h>   using namespace std;   struct par {     int x, y, label;     par(int _x, int _y, int _label) {       x = _x;       y = _y;       label = _label;     }     par() {}   };   bool operator<(par p1, par p2) {     if (p1.x != p2.x) return p1.x < p2.x;     return p1.y < p2.y;   }   int main() {     int n;     while (cin >> n) {       vector<par> V;       int x, y;       for (int i = 0; i < n; i++) {         cin >> x >> y;         V.push_back(par(x, y, i + 1));       }       sort((V).begin(), (V).end());       vector<int> sol;       for (int i = 0; i < n; i++) {         bool ok = 1;         vector<par> aux;         for (int j = 0; j < n; j++)           if (j != i) aux.push_back(V[j]);         for (int j = 1; j < aux.size(); j++) {           if (aux[j - 1].y > aux[j].x) {             ok = 0;             break;           }         }         if (ok) sol.push_back(V[i].label);       }       sort((sol).begin(), (sol).end());       cout << sol.size() << endl;       for (int i = 0; i < sol.size(); i++) {         if (i == 0)           printf( %d , sol[i]);         else           printf(  %d , sol[i]);       }     }   }   