#include <bits/stdc++.h>
using namespace std;
pair<int, int> operator+(const pair<int, int> &a, const pair<int, int> &b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
pair<int, int> operator-(const pair<int, int> &a, const pair<int, int> &b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
pair<int, int> &operator+=(pair<int, int> &a, const pair<int, int> &b) {
  a.first += b.first;
  a.second += b.second;
  return a;
}
pair<int, int> &operator-=(pair<int, int> &a, const pair<int, int> &b) {
  a.first -= b.first;
  a.second -= b.second;
  return a;
}
template <class T, class U>
bool cmp_second(const pair<T, U> &a, const pair<T, U> &b) {
  return a.second < b.second;
}
template <class T>
T gcd(T a, T b) {
  a = abs(a);
  b = abs(b);
  while (b) {
    T t = b;
    b = a % b;
    a = t;
  }
  return a;
}
template <class T>
pair<T, T> ext_gcd(T a, T b) {
  T a0 = 1, a1 = 0, b0 = 0, b1 = 1;
  if (a < 0) {
    a = -a;
    a0 = -1;
  }
  if (b < 0) {
    b = -b;
    b1 = -1;
  }
  while (b) {
    T t, q = a / b;
    t = b;
    b = a - b * q;
    a = t;
    t = b0;
    b0 = a0 - b0 * q;
    a0 = t;
    t = b1;
    b1 = a1 - b1 * q;
    a1 = t;
  }
  return make_pair(a0, a1);
}
inline int sg(int x) { return x ? (x > 0 ? 1 : -1) : 0; }
const int inf = 1000000;
class Segment {
 public:
  int l, r, id;
};
class Node {
 public:
  int vl, vr;
  int cnt, mii;
  pair<int, int> mil;
  priority_queue<int, vector<int>, greater<int> > pq;
  Node *_l, *_r;
  Node(int vl, int vr) : vl(vl), vr(vr) {
    cnt = 0;
    mil = make_pair(inf, -1);
    mii = inf;
    if (vl == vr) pq.push(inf);
    _l = _r = NULL;
  }
  ~Node() {
    delete _l;
    delete _r;
  }
  Node *left() {
    if (!_l) _l = new Node(vl, (vl + vr) / 2);
    return _l;
  }
  Node *right() {
    if (!_r) _r = new Node((vl + vr) / 2 + 1, vr);
    return _r;
  }
  void insert(int x, int ind) {
    cnt++;
    mii = min(mii, ind);
    if (vl == vr) {
      if (cnt)
        mil = make_pair(vl - cnt, vl);
      else
        mil = make_pair(inf, -1);
      pq.push(ind);
    } else {
      int m = (vl + vr) / 2;
      if (x <= m)
        left()->insert(x, ind);
      else
        right()->insert(x, ind);
      mil = min(left()->mil, right()->mil - make_pair(left()->cnt, 0));
    }
  }
  int getmin(int r) {
    if (r == vr)
      return mii;
    else {
      int m = (vl + vr) / 2;
      if (r <= m)
        return left()->getmin(r);
      else
        return min(left()->getmin(m), right()->getmin(r));
    }
  }
  int takemin(int r) { return takemin(r, getmin(r)); }
  int takemin(int r, int minval) {
    cnt--;
    if (vl == vr) {
      int ind = pq.top();
      pq.pop();
      mii = pq.top();
      if (cnt)
        mil = make_pair(vl - cnt, vl);
      else
        mil = make_pair(inf, -1);
      return ind;
    } else {
      int ret, m = (vl + vr) / 2;
      if (r <= m)
        ret = left()->takemin(r, minval);
      else if (left()->mii == minval)
        ret = left()->takemin(m, minval);
      else
        ret = right()->takemin(r, minval);
      mii = min(left()->mii, right()->mii);
      mil = min(left()->mil, right()->mil - make_pair(left()->cnt, 0));
      return ret;
    }
  }
};
int n;
Segment segbyr[2050], segbyl[2050];
int ans[2050], id2ri[2050];
bool used[2050];
bool cmpr(const Segment &a, const Segment &b) {
  if (a.r != b.r)
    return a.r < b.r;
  else
    return a.l < b.l;
}
bool cmpl(const Segment &a, const Segment &b) { return a.l < b.l; }
bool valid(int thr) {
  int sbli = 0, sbri = 0;
  Node tr(0, n);
  for (int i = 0; i < n; i++) used[i] = 0;
  for (int i = 0; i < n; i++) {
    int lb = tr.mil.first;
    int at = tr.mil.second;
    int ind;
    if (lb < i) return 0;
    if (lb > i) {
      while (sbri < n && used[sbri]) sbri++;
      assert(sbri < n);
      if (tr.getmin(n) == sbri)
        ind = tr.takemin(n);
      else
        ind = sbri;
    } else {
      ind = tr.takemin(at);
    }
    ans[i] = segbyr[ind].id;
    used[ind] = 1;
    while (sbli < n && segbyl[sbli].l <= segbyr[ind].r) {
      int u = id2ri[segbyl[sbli++].id];
      if (used[u]) continue;
      tr.insert(i + thr, u);
    }
  }
  return 1;
}
void solve() {
  sort(segbyr, segbyr + n, cmpr);
  sort(segbyl, segbyl + n, cmpl);
  for (int i = 0; i < n; i++) id2ri[segbyr[i].id] = i;
  int lb = -1, rb = n;
  while (lb < rb - 1) {
    int m = (lb + rb) / 2;
    if (valid(m))
      rb = m;
    else
      lb = m;
  }
  valid(rb);
  for (int i = 0; i < n; i++)
    printf("%d%c", ans[i] + 1, i + 1 < n ? ' ' : '\n');
}
int main(void) {
  vector<pair<int, int> > e;
  scanf("%d", &(n));
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &(segbyr[i].l), &(segbyr[i].r));
    segbyr[i].id = i;
    segbyl[i] = segbyr[i];
  }
  solve();
  return 0;
}
