#include <bits/stdc++.h>
using namespace std;
int d[2100], q[2100], ll[2100], rr[2100], s[2100], n;
bool p[2100][2100];
bool check(int k) {
  for (int i = 1; i <= n; i++) d[i] = n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) s[j] = 0;
    for (int j = 1; j <= n; j++) ++s[d[j]];
    for (int j = 2; j <= n; j++) s[j] += s[j - 1];
    for (int j = i; j <= n; j++)
      if (s[j] > j) return 0;
    for (int j = i; j <= n; j++)
      if (s[j] == j) {
        int lab = 0;
        for (int z = 1; z <= n; z++)
          if (d[z] >= i && d[z] <= j && (!lab || rr[z] < rr[lab])) lab = z;
        d[lab] = i;
        for (int z = 1; z <= n; z++)
          if (p[lab][z]) d[z] = min(d[z], i + k);
        break;
      }
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &ll[i], &rr[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) p[i][j] = !(rr[i] < ll[j] || ll[i] > rr[j]);
  int l = 1, r = n;
  while (l < r) {
    int mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  check(l);
  for (int i = 1; i <= n; i++) q[d[i]] = i;
  for (int i = 1; i <= n; i++) printf("%d ", q[i]);
  printf("\n");
  return 0;
}
