#include <bits/stdc++.h>
using namespace std;
int Read() {
  char c;
  while (c = getchar(), (c != '-') && (c < '0' || c > '9'))
    ;
  bool neg = (c == '-');
  int ret = (neg ? 0 : c - 48);
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + c - 48;
  return neg ? -ret : ret;
}
const int MAXN = 2005;
int N, l[MAXN], r[MAXN], s[MAXN], ans[MAXN], lim[MAXN];
bool use[MAXN], eff[MAXN], g[MAXN][MAXN];
void init() {
  scanf("%d", &N);
  r[0] = 1 + 1e9;
  for (int i = 1; i <= N; i++) l[i] = Read(), r[i] = Read();
  for (int i = 1; i <= N; i++)
    for (int j = i + 1; j <= N; j++)
      if (l[i] <= r[j] && l[j] <= r[i]) g[i][j] = g[j][i] = 1;
}
bool Solve(int mid) {
  for (int i = 1; i <= N; i++) lim[i] = N, use[i] = 1, eff[i] = 1;
  for (int j = 1; j <= N; j++) {
    int po = 0;
    for (int i = 1; i <= N; i++)
      if (eff[i] && r[i] < r[po]) po = i;
    use[po] = 0, ans[j] = po;
    if (j == N) return 1;
    for (int i = 1; i <= N; i++)
      if (use[i] && g[po][i]) lim[i] = min(lim[i], j + mid);
    for (int i = 0; i <= N; i++) s[i] = 0;
    for (int i = 1; i <= N; i++) s[max(0, lim[i] - j)] += use[i];
    for (int i = 1; i <= N - j; i++) s[i] += s[i - 1];
    for (int i = 0; i <= N - j; i++)
      if (s[i] > i) return 0;
    int k = N;
    for (int i = 1; i <= N - j; i++)
      if (s[i] == i) {
        k = i;
        break;
      }
    for (int i = 1; i <= N; i++) eff[i] = use[i] & (lim[i] <= j + k);
  }
}
void work() {
  int l = 1, r = N;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (Solve(mid))
      r = mid;
    else
      l = mid + 1;
  }
  Solve(r);
  for (int i = 1; i <= N; i++) printf("%d%c", ans[i], i < N ? ' ' : '\n');
}
int main() {
  init();
  work();
  return 0;
}
