#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 5;
bool v[N];
bool l[N][N];
int n;
int d[N], lim[N], sum[N], ans[N];
struct pis {
  int l, r, w;
} p[N];
bool cmp(pis a, pis b) { return a.r < b.r; }
bool Check(int len) {
  memset(d, 0, sizeof(d));
  memset(v, 1, sizeof(v));
  for (int i = 1; i <= n; i++) lim[i] = n;
  int j;
  for (int i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++)
      if (v[j]) break;
    d[j] = lim[j] = i;
    for (int k = 1; k <= n; k++)
      if (l[j][k]) lim[k] = min(lim[k], i + len);
    memset(sum, 0, sizeof(sum));
    for (int k = 1; k <= n; k++) sum[lim[k]]++;
    for (int k = 1; k <= n; k++)
      if ((sum[k] += sum[k - 1]) > k) return 0;
    for (j = i + 1; j <= n; j++)
      if (sum[j] == j) break;
    for (int k = 1; k <= n; k++) v[k] = (!d[k] && lim[k] <= j);
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &p[i].l, &p[i].r);
    p[i].w = i;
  }
  sort(p + 1, p + n + 1, cmp);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) l[i][j] = l[j][i] = (p[i].r >= p[j].l);
  int l = 0, r = n - 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (Check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  Check(l);
  for (int i = 1; i <= n; i++) ans[d[i]] = i;
  for (int i = 1; i <= n; i++) printf("%d ", p[ans[i]].w);
  printf("\n");
  return 0;
}
