#include <bits/stdc++.h>
using namespace std;
struct node {
  int poped;
  int pushed;
  int value;
};
node tree[(1 << 20)];
void update(int idx, int value, int type, int par, int st, int ed) {
  if (st == ed) {
    tree[par].poped = (type == 0);
    tree[par].pushed = (type == 1);
    tree[par].value = value;
    return;
  }
  int mid = (st + ed) / 2;
  if (idx <= mid) {
    update(idx, value, type, par * 2, st, mid);
  } else {
    update(idx, value, type, par * 2 + 1, mid + 1, ed);
  }
  tree[par].poped = tree[par * 2].poped;
  tree[par].pushed = tree[par * 2 + 1].pushed;
  tree[par].poped += max(0, tree[par * 2 + 1].poped - tree[par * 2].pushed);
  tree[par].pushed += max(0, tree[par * 2].pushed - tree[par * 2 + 1].poped);
}
int query(int rem, int par, int st, int ed) {
  if (st == ed) {
    return tree[par].value;
  }
  int mid = (st + ed) / 2;
  int ret;
  if (tree[par * 2 + 1].pushed > rem) {
    ret = query(rem, par * 2 + 1, mid + 1, ed);
  } else {
    ret =
        query(rem + tree[par * 2].pushed - tree[par].pushed, par * 2, st, mid);
  }
  return ret;
}
int main() {
  int m;
  int p, t, x;
  int answer;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &p, &t);
    if (t == 1) {
      scanf("%d", &x);
    }
    update(p, x, t, 1, 1, m);
    if (tree[1].pushed) {
      answer = query(0, 1, 1, m);
    } else {
      answer = -1;
    }
    printf("%d\n", answer);
  }
  return 0;
}
