#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r, id;
  bool operator<(const node &t) const { return r < t.r; }
} a[2001];
int n, num[2001], s[2001], last[2001];
bool e[2001][2001], use[2001];
bool check(int d) {
  memset(use, false, sizeof(use));
  for (int i = 1; i <= n; i++) last[i] = n;
  for (int i = 1, now = 1; i <= n; i++) {
    num[i] = now;
    use[now] = true;
    memset(s, 0, sizeof(s));
    for (int j = 1; j <= n; j++)
      if (!use[j] && e[now][j] && i + d < last[j]) last[j] = i + d;
    for (int j = 1; j <= n; j++)
      if (!use[j]) s[last[j]]++;
    for (int j = 1; j <= n; j++) s[j] += s[j - 1];
    for (int j = i; j <= n; j++)
      if (s[j] > j - i) return false;
    for (now = i + 1; now <= n; now++)
      if (s[now] == now - i) break;
    for (int j = 1; j <= n; j++)
      if (!use[j] && last[j] <= now) {
        now = j;
        break;
      }
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].l, &a[i].r), a[i].id = i;
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (a[j].l <= a[i].r) e[i][j] = e[j][i] = true;
  int l = -1, r = n - 1, mid;
  while (l + 1 < r) {
    mid = l + r >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  check(r);
  for (int i = 1; i <= n; i++) cout << a[num[i]].id << " ";
}
