#include <bits/stdc++.h>
using namespace std;
struct pp {
  int lc, rc, k, mark;
} p[200010];
int root, pl;
int A[100010];
void Mark(int &x, int k) {
  if (!x) x = ++pl;
  p[x].k += k;
  p[x].mark += k;
}
void down(int x) {
  Mark(p[x].lc, p[x].mark);
  Mark(p[x].rc, p[x].mark);
  p[x].mark = 0;
}
void build(int &x, int l, int r, int ll, int rr, int k) {
  if (!x) x = ++pl;
  if (l == ll && r == rr) {
    Mark(x, k);
    return;
  }
  int mid = (l + r) >> 1;
  if (p[x].mark) down(x);
  if (rr <= mid)
    build(p[x].lc, l, mid, ll, rr, k);
  else if (ll > mid)
    build(p[x].rc, mid + 1, r, ll, rr, k);
  else {
    build(p[x].lc, l, mid, ll, mid, k);
    build(p[x].rc, mid + 1, r, mid + 1, rr, k);
  }
  p[x].k = max(p[p[x].lc].k, p[p[x].rc].k);
}
int Q(int x, int l, int r) {
  if (l == r) return l;
  int mid = (l + r) >> 1;
  if (p[x].mark) down(x);
  if (p[p[x].rc].k >= 1) return Q(p[x].rc, mid + 1, r);
  return Q(p[x].lc, l, mid);
}
int main() {
  int n, i, j, x, t;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &x, &t);
    if (t == 1) {
      scanf("%d", &A[x]);
      build(root, 1, n, 1, x, 1);
    } else
      build(root, 1, n, 1, x, -1);
    if (p[root].k >= 1)
      printf("%d\n", A[Q(root, 1, n)]);
    else
      printf("-1\n");
  }
  return 0;
}
