#include <bits/stdc++.h>
using namespace std;
int ans[100050], n;
const int inf = (1 << 28);
struct Node {
  Node *ch[2], *pre;
  int mx, sz, key, id;
};
class Splay {
 public:
  void init() {
    cnt = 0;
    nill = node;
    nill->sz = 0;
    nill->mx = -inf;
    root = new_node(nill, -inf, 0);
    root->ch[1] = new_node(root, -inf, 0);
    up(root);
  }
  void insert(int v, int c, int id) {
    Node *x = larger(v);
    int k = 0;
    if (x != nill) k = find_rank(x);
    k = max(k, id - 1 - c);
    rotate_to(k, nill);
    rotate_to(k + 1, root);
    root->ch[1]->ch[0] = new_node(root->ch[1], v, id);
    up(root->ch[1]);
    up(root);
  }
  void out() {
    cnt = 0;
    dfs(root);
    for (int i = 1; i < cnt - 1; i++) {
      printf("%d", ans[i]);
      if (i == cnt - 2)
        printf("\n");
      else
        printf(" ");
    }
  }

 private:
  int cnt;
  Node node[100050], *root, *nill;
  void up(Node *x) {
    x->sz = 1 + x->ch[0]->sz + x->ch[1]->sz;
    x->mx = max(x->key, max(x->ch[0]->mx, x->ch[1]->mx));
  }
  Node *new_node(Node *f, int v, int id) {
    Node *x = &node[++cnt];
    x->key = v;
    x->id = id;
    x->mx = v;
    x->sz = 1;
    x->ch[0] = x->ch[1] = nill;
    x->pre = f;
    return x;
  }
  void rotate(Node *x, int f) {
    Node *y = x->pre;
    y->ch[!f] = x->ch[f];
    x->ch[f]->pre = y;
    x->pre = y->pre;
    if (y->pre != nill) y->pre->ch[y->pre->ch[1] == y] = x;
    x->ch[f] = y;
    y->pre = x;
    up(y);
  }
  void splay(Node *x, Node *to) {
    while (x->pre != to) {
      if (x->pre->pre == to)
        rotate(x, x->pre->ch[0] == x);
      else {
        Node *y = x->pre, *z = y->pre;
        int f = (z->ch[0] == y);
        if (y->ch[f] == x)
          rotate(x, !f), rotate(x, f);
        else
          rotate(y, f), rotate(x, f);
      }
    }
    up(x);
    if (to == nill) root = x;
  }
  Node *larger(int v) {
    if (root->mx <= v) return nill;
    Node *x = root;
    while (true) {
      if (x->ch[1]->mx > v)
        x = x->ch[1];
      else if (x->key > v)
        return x;
      else
        x = x->ch[0];
    }
  }
  int find_rank(Node *x) {
    splay(x, nill);
    return x->ch[0]->sz;
  }
  void rotate_to(int k, Node *to) {
    Node *x = root;
    while (x->ch[0]->sz != k) {
      if (x->ch[0]->sz > k)
        x = x->ch[0];
      else {
        k -= (1 + x->ch[0]->sz);
        x = x->ch[1];
      }
    }
    splay(x, to);
  }
  void dfs(Node *x) {
    if (x == nill) return;
    dfs(x->ch[0]);
    ans[cnt++] = x->id;
    dfs(x->ch[1]);
  }
};
Splay splay;
int main() {
  while (scanf("%d", &n) == 1) {
    splay.init();
    for (int i = 1; i <= n; i++) {
      int v, c;
      scanf("%d%d", &v, &c);
      splay.insert(v, c, i);
    }
    splay.out();
  }
  return 0;
}
