#include <bits/stdc++.h>
const int MAXN = 100005;
int n, val[MAXN], ch[MAXN][2], fa[MAXN], maxv[MAXN], size[MAXN], root;
inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a > b ? b : a; }
inline void maintain(int x) {
  size[x] = size[ch[x][0]] + size[ch[x][1]] + 1;
  maxv[x] = max(max(maxv[ch[x][0]], maxv[ch[x][1]]), val[x]);
}
void rotate(int x) {
  int y = fa[x], d = ch[y][1] == x;
  if (fa[x] = fa[y]) ch[fa[y]][ch[fa[y]][1] == y] = x;
  if (ch[y][d] = ch[x][d ^ 1]) fa[ch[y][d]] = y;
  fa[ch[x][d ^ 1] = y] = x;
  maintain(y), maintain(x);
}
void splay(int &rt, int x) {
  int f = fa[rt], y, z;
  while ((y = fa[x]) != f && (z = fa[y]) != f) {
    rotate((ch[z][1] == y) == (ch[y][1] == x) ? y : x);
    rotate(x);
  }
  if (y != f) rotate(x);
  rt = x;
}
void select(int &rt, int k) {
  int x = rt;
  while (size[ch[x][0]] + 1 != k) {
    if (k <= size[ch[x][0]])
      x = ch[x][0];
    else {
      k -= size[ch[x][0]] + 1;
      x = ch[x][1];
    }
  }
  splay(rt, x);
}
void getPos(int &rt, int v) {
  int x = rt;
  while (true) {
    if (ch[x][1] && maxv[ch[x][1]] > v)
      x = ch[x][1];
    else if (ch[x][0] && val[x] <= v)
      x = ch[x][0];
    else
      break;
  }
  splay(rt, x);
}
void insert(int &rt, int p, int pos) {
  if (!pos) {
    select(rt, 1);
    fa[ch[rt][0] = p] = rt;
    rotate(p);
    rt = p;
    return;
  }
  select(rt, pos);
  int tmp = ch[rt][1];
  if (!tmp) {
    fa[ch[rt][1] = p] = rt;
    rotate(p);
    rt = p;
    return;
  }
  fa[ch[rt][1] = p] = rt;
  fa[ch[p][1] = tmp] = p;
  splay(rt, tmp);
}
void traverse(int x) {
  if (!x) return;
  traverse(ch[x][0]);
  printf("%d ", x);
  traverse(ch[x][1]);
}
int main() {
  int tmp, i;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d%d", &val[i], &tmp);
    if (i == 1) {
      size[root = 1] = 1;
      maxv[1] = val[1];
      continue;
    }
    getPos(root, val[i]);
    if (val[root] < val[i])
      insert(root, i, i - 1 - min(tmp, i - 1));
    else
      insert(root, i, i - 1 - min(tmp, size[ch[root][1]]));
  }
  traverse(root);
  return 0;
}
