#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 15;
struct Node {
  int x, y, num;
} a[maxn];
int n;
int dy[maxn];
int pos[maxn], maxd[maxn], sum[maxn];
bool cross(int i, int j) {
  if (max(a[i].x, a[j].x) <= min(a[i].y, a[j].y)) return true;
  return false;
}
bool check(int x) {
  for (int i = 1; i <= n; i++) maxd[i] = n, pos[i] = 0;
  int count = 1;
  for (int i = 1; i <= n; i++) {
    pos[count] = i;
    maxd[count] = i;
    dy[i] = a[count].num;
    for (int j = 1; j <= n; j++)
      if (pos[j] == 0 && cross(count, j)) maxd[j] = min(maxd[j], i + x);
    memset(sum, 0, sizeof(sum));
    for (int j = 1; j <= n; j++) sum[maxd[j]]++;
    for (int j = 1; j <= n; j++) {
      sum[j] += sum[j - 1];
      if (sum[j] > j) return 0;
    }
    int j;
    for (j = i + 1; j <= n; j++)
      if (sum[j] == j) break;
    for (count = 1; count <= n; count++)
      if (pos[count] == 0)
        if (i < maxd[count] && maxd[count] <= j) break;
  }
  return 1;
}
bool cmp(Node a, Node b) { return a.y < b.y; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y), a[i].num = i;
  sort(a + 1, a + n + 1, cmp);
  int l = -1, r = n - 1, midd;
  while (l + 1 < r) {
    midd = (l + r) >> 1;
    if (check(midd))
      r = midd;
    else
      l = midd;
  }
  check(r);
  for (int i = 1; i < n; i++) printf("%d ", dy[i]);
  printf("%d\n", dy[n]);
  return 0;
}
