#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 2005;
int n, dl[2005], l[2005], r[2005], cnt[2005], flg[2005], sol[2005];
inline bool check(int d) {
  for (int i = 1; i <= n; i++) {
    dl[i] = n;
    sol[i] = flg[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    int b = 0, p = 0;
    memset(cnt, 0, sizeof(cnt));
    for (int j = 1; j <= n; j++)
      if (!flg[j]) cnt[dl[j]]++;
    for (int j = 1; j <= n; j++) cnt[j] += cnt[j - 1];
    for (int j = 1; j <= n; j++)
      if (cnt[j] > max(0, j - i + 1)) return 0;
    for (int j = n; j >= i; j--)
      if (cnt[j] == j - i + 1) b = j;
    for (int j = 1; j <= n; j++)
      if (!flg[j] && dl[j] <= b && r[j] < r[p]) p = j;
    flg[sol[i] = p] = 1;
    for (int j = 1; j <= n; j++)
      if (l[j] <= r[p] && l[p] <= r[j]) dl[j] = min(dl[j], i + d);
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  r[0] = inf;
  for (int i = 1; i <= n; i++) scanf("%d%d", &l[i], &r[i]);
  int l = 1, r = n - 1;
  while (l < r) {
    int mid = l + r >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  check(l);
  for (int i = 1; i <= n; i++) printf("%d ", sol[i]);
  return 0;
}
