#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int n, val[MAXN];
int lastt, lastidx = -1;
namespace SGT {
int sum[MAXN << 2] = {0}, maxsf[MAXN << 2] = {0};
int left, right, val;
void _modify(int o, int L, int R) {
  if (L == R) {
    sum[o] = maxsf[o] = val;
    return;
  }
  int M = (L + R) >> 1;
  int lc = o << 1;
  int rc = lc | 1;
  if (left <= M)
    _modify(lc, L, M);
  else
    _modify(rc, M + 1, R);
  sum[o] = sum[lc] + sum[rc];
  maxsf[o] = max(maxsf[rc], sum[rc] + maxsf[lc]);
}
void modify(int x, int v) {
  left = x;
  val = v;
  _modify(1, 1, n);
}
int _query(int o, int L, int R, int sf) {
  if (L == R) return L;
  int M = (L + R) >> 1;
  int lc = o << 1;
  int rc = lc | 1;
  if (maxsf[rc] + sf >= 1)
    return _query(rc, M + 1, R, sf);
  else
    return _query(lc, L, M, sf + sum[rc]);
}
int query() { return _query(1, 1, n, 0); }
}  // namespace SGT
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int p, t;
    scanf("%d%d", &p, &t);
    if (p > lastidx) lastidx = p, lastt = t;
    if (t == 0)
      SGT::modify(p, -1);
    else {
      SGT::modify(p, 1);
      scanf("%d", &val[p]);
    }
    if (lastt == 1)
      printf("%d\n", val[lastidx]);
    else if (SGT::maxsf[1] >= 1) {
      int idx = SGT::query();
      printf("%d\n", val[idx]);
    } else
      printf("-1\n");
  }
  return 0;
}
