#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, x, y, l, r, mid;
struct item {
  int mx, cnt, prior, key, num;
  item *l, *r;
  item() {}
  item(int _key, int _num) {
    num = _num, key = _key, mx = -1e9, prior = rand(), l = nullptr, r = nullptr;
  }
};
typedef item *pitem;
pitem t;
void Output(pitem v) {
  if (!v) {
    return;
  }
  Output(v->l);
  cout << v->num << " ";
  Output(v->r);
}
inline int mx(pitem v) { return v ? v->mx : -1e9; }
inline int cnt(pitem v) { return v ? v->cnt : 0; }
inline void upd_cnt(pitem v) {
  if (v) {
    v->cnt = cnt(v->l) + cnt(v->r) + 1;
    v->mx = max(max(mx(v->r), mx(v->l)), v->key);
  }
}
void Split(pitem v, int key, pitem &l, pitem &r, int add = 0) {
  if (!v) {
    l = r = nullptr;
    return;
  }
  int cur_key = add + cnt(v->l);
  if (cur_key >= key) {
    Split(v->l, key, l, v->l, add);
    r = v;
  } else {
    Split(v->r, key, v->r, r, add + 1 + cnt(v->l));
    l = v;
  }
  upd_cnt(v);
}
void Merge(pitem &v, pitem l, pitem r) {
  if (!l || !r) {
    v = l ? l : r;
  } else if (l->prior > r->prior) {
    Merge(l->r, l->r, r);
    v = l;
  } else {
    Merge(r->l, l, r->l);
    v = r;
  }
  upd_cnt(v);
}
int get_max(int l, int r) {
  pitem cur, temp;
  Split(t, l - 1, cur, t);
  Split(t, r - l + 1, temp, t);
  int x = mx(temp);
  Merge(cur, cur, temp);
  Merge(t, cur, t);
  return x;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    l = max(1, i - y), r = i;
    while (r - l > 1) {
      mid = (r + l) >> 1;
      if (get_max(mid, i) > x) {
        l = mid;
      } else {
        r = mid;
      }
    }
    if (get_max(l, i) < x) {
      pitem cur;
      Split(t, l - 1, cur, t);
      Merge(cur, cur, new item(x, i));
      Merge(t, cur, t);
    } else {
      pitem cur;
      Split(t, r - 1, cur, t);
      Merge(cur, cur, new item(x, i));
      Merge(t, cur, t);
    }
  }
  Output(t);
}
