#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 50005;
int n;
pi a[MAXN];
vector<int> lvl[MAXN];
int ans[MAXN], f[MAXN];
bool trial(int k) {
  for (int i = 0; i < n; i++) lvl[i].clear();
  for (int i = 0; i < n; i++) {
    f[i] = n - 1;
    lvl[n - 1].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    int lastpos = -1;
    int sum = 0;
    for (int j = i; j < n; j++) {
      sum += ((int)(lvl[j]).size());
      if (sum > j - i + 1) {
        return 0;
      }
      if (sum == j - i + 1 && lastpos == -1) lastpos = j;
    }
    if (lastpos == -1) return 0;
    pi ret(2e9, -1);
    for (int j = i; j <= lastpos; j++) {
      for (auto &k : lvl[j]) {
        ret = min(ret, pi(a[k].second, k));
      }
    }
    int idx = ret.second;
    ans[i] = idx;
    lvl[f[idx]].erase(find((lvl[f[idx]]).begin(), (lvl[f[idx]]).end(), idx));
    if (k + i < n - 1) {
      vector<int> aux;
      for (auto &x : lvl[n - 1]) {
        if (a[x].first <= a[idx].second) {
          f[x] = k + i;
          lvl[k + i].push_back(x);
        } else
          aux.push_back(x);
      }
      lvl[n - 1] = aux;
    }
  }
  return 1;
}
void solve() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d", &a[i].first, &a[i].second);
  int s = 1, e = n - 1;
  while (s != e) {
    int m = (s + e) / 2;
    if (trial(m))
      e = m;
    else
      s = m + 1;
  }
  trial(s);
  for (int i = 0; i < n; i++) printf("%d ", 1 + ans[i]);
}
int main() {
  int tc = 1;
  while (tc--) {
    solve();
  }
}
