#include <climits>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

struct Seg {
  int l, r, i;
  bool operator < ( const Seg &s ) const {
    return r < s.r;
  }
};
const int N = 1e5;
int n;
Seg seg[N];
int main() {
  scanf("%d", &n);
  forn(i, n)
    scanf("%d%d", &seg[i].l, &seg[i].r), seg[i].i = i;
  sort(seg, seg + n); // iterators

  int last_r = INT_MIN;
  forn(i, n)
    if (seg[i].l > last_r)
      last_r = seg[i].r, printf("%d ", seg[i].i);
}