#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 5;
int n, w[maxn];
struct Tree {
  int l, r, push, pop;
} tree[maxn << 2];
inline void build(int l, int r, int tr) {
  tree[tr].l = l, tree[tr].r = r, tree[tr].push = tree[tr].pop = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(l, mid, tr << 1);
  build(mid + 1, r, tr << 1 | 1);
}
inline void change(int pos, int x, int tr) {
  if (tree[tr].l == tree[tr].r) {
    if (x)
      tree[tr].push = 1;
    else
      tree[tr].pop = 1;
    return;
  }
  int mid = (tree[tr].l + tree[tr].r) >> 1;
  if (pos <= mid)
    change(pos, x, tr << 1);
  else
    change(pos, x, tr << 1 | 1);
  int lala = min(tree[tr << 1].push, tree[tr << 1 | 1].pop);
  tree[tr].push = tree[tr << 1].push + tree[tr << 1 | 1].push - lala;
  tree[tr].pop = tree[tr << 1].pop + tree[tr << 1 | 1].pop - lala;
}
inline int query(int sum, int tr) {
  if (!tree[tr].push) return -1;
  if (tree[tr].l == tree[tr].r) return w[tree[tr].l];
  int mid = (tree[tr].l + tree[tr].r) >> 1;
  if (tree[tr << 1 | 1].push + sum > 0)
    return query(sum, tr << 1 | 1);
  else
    return query(sum + tree[tr << 1 | 1].push - tree[tr << 1 | 1].pop, tr << 1);
}
signed main(void) {
  scanf("%d", &n);
  build(1, n, 1);
  for (int i = 1, pos, opt, x; i <= n; i++) {
    scanf("%d%d", &pos, &opt);
    if (opt == 1) scanf("%d", &w[pos]);
    change(pos, opt, 1);
    printf("%d\n", query(0, 1));
  }
  return 0;
}
