#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int la[N], id[N], cnt[N];
int n, e[N][N];
struct node {
  int x, y, id;
  bool operator<(const node &a) const { return y < a.y; }
} a[N];
bool check(int mid) {
  int p = 1, pp = 0;
  for (int i = (int)(1); i <= (int)(n); i++) la[i] = n;
  for (int i = (int)(1); i <= (int)(n); i++) {
    id[i] = a[p].id;
    la[p] = i;
    for (int j = (int)(1); j <= (int)(n); j++)
      if (e[p][j]) la[j] = min(la[j], i + mid);
    for (int j = (int)(1); j <= (int)(n); j++) cnt[j] = 0;
    for (int j = (int)(1); j <= (int)(n); j++) cnt[la[j]]++;
    for (int j = (int)(1); j <= (int)(n); j++) cnt[j] += cnt[j - 1];
    for (int j = (int)(1); j <= (int)(n); j++)
      if (cnt[j] > j) return 0;
    for (pp = i + 1; cnt[pp] < pp; ++pp)
      ;
    for (int j = (int)(n); j >= (int)(1); j--)
      if (i < la[j] && la[j] <= pp) p = j;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = (int)(1); i <= (int)(n); i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    a[i].id = i;
  }
  sort(a + 1, a + n + 1);
  for (int i = (int)(1); i <= (int)(n); i++)
    for (int j = (int)(i + 1); j <= (int)(n); j++)
      if (a[j].x <= a[i].y) e[i][j] = e[j][i] = 1;
  int l = 1, r = n, ans = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  check(ans);
  for (int i = (int)(1); i <= (int)(n); i++) printf("%d ", id[i]);
}
