#include <bits/stdc++.h>
using namespace std;
struct node {
  int open, close;
  node(int open = 0, int close = 0) : open(open), close(close) {}
};
int n;
node st[1000000];
int a[100005];
void merge(node& res, node& x, node& y) {
  int mn = min(x.open, y.close);
  res.open = x.open + y.open - mn;
  res.close = x.close + y.close - mn;
}
void build(int p = 1, int l = 1, int r = n) {
  if (l == r) {
    st[p] = node(0, 0);
    return;
  }
  int mid = (l + r) >> 1;
  build(p * 2, l, mid);
  build(p * 2 + 1, mid + 1, r);
  merge(st[p], st[p * 2], st[p * 2 + 1]);
}
void update(int i, int val, int p = 1, int l = 1, int r = n) {
  if (i > r || i < l) return;
  if (i == l && i == r) {
    if (val < 0)
      st[p] = node(0, 1);
    else
      st[p] = node(1, 0);
    return;
  }
  int mid = (l + r) >> 1;
  update(i, val, p * 2, l, mid);
  update(i, val, p * 2 + 1, mid + 1, r);
  merge(st[p], st[p * 2], st[p * 2 + 1]);
}
int query(int rclose, int p = 1, int l = 1, int r = n) {
  if (st[p].open == 0) return -1;
  if (l == r) return a[l];
  int mid = (l + r) >> 1;
  if (st[p * 2 + 1].open - rclose > 0)
    return query(rclose, p * 2 + 1, mid + 1, r);
  else
    return query(rclose + st[p * 2 + 1].close - st[p * 2 + 1].open, p * 2, l,
                 mid);
}
int main() {
  scanf("%d", &n);
  int x, t, val;
  build();
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &t);
    if (t == 0) {
      update(x, -1);
    } else {
      scanf("%d", &val);
      update(x, +1);
      a[x] = val;
    }
    int ans = query(0);
    printf("%d\n", ans);
  }
  return 0;
}
