#include <bits/stdc++.h>
using namespace std;
int f[800005], m, a, b, c, A[100005], lz[800005];
void lazy(int x, int l, int r) {
  if (l != r) {
    lz[x * 2] += lz[x];
    lz[x * 2 + 1] += lz[x];
  }
  f[x] += lz[x];
  lz[x] = 0;
}
int upd(int x, int l, int r, int ll, int rr, int val) {
  lazy(x, l, r);
  if (l > rr || r < ll) return f[x];
  if (l >= ll && r <= rr) {
    lz[x] += val;
    lazy(x, l, r);
    return f[x];
  }
  int md = (l + r) / 2;
  f[x] = max(upd(x * 2, l, md, ll, rr, val),
             upd(x * 2 + 1, md + 1, r, ll, rr, val));
  return f[x];
}
int que(int x, int l, int r) {
  lazy(x, l, r);
  if (f[x] <= 0) return 0;
  if (l == r) return l;
  int md = (l + r) / 2;
  lazy(x * 2, l, md);
  lazy(x * 2 + 1, md + 1, r);
  if (f[x * 2 + 1] > 0)
    return que(x * 2 + 1, md + 1, r);
  else
    return que(x * 2, l, md);
}
int main() {
  A[0] = -1;
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d", &a, &b);
    if (b == 0)
      upd(1, 1, m, 1, a, -1);
    else {
      scanf("%d", &A[a]);
      upd(1, 1, m, 1, a, 1);
    }
    printf("%d\n", A[que(1, 1, m)]);
  }
}
