#include <bits/stdc++.h>
using namespace std;
int n, m;
int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * f;
}
const int maxn = 4e5 + 10;
int ans[maxn], sum[maxn], mx[maxn];
void pushup(int x) {
  sum[x] = sum[x << 1] + sum[x << 1 | 1];
  mx[x] = max(mx[x << 1 | 1], mx[x << 1] + sum[x << 1 | 1]);
}
void update(int x, int l, int r, int val, int pos) {
  if (l == r) {
    sum[x] = mx[x] = val;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    update(x << 1, l, mid, val, pos);
  else
    update(x << 1 | 1, mid + 1, r, val, pos);
  pushup(x);
}
int query(int x, int l, int r, int nw) {
  if (l == r) return l;
  int mid = (l + r) >> 1;
  if (nw + mx[x << 1 | 1] > 0)
    return query(x << 1 | 1, mid + 1, r, nw);
  else
    return query(x << 1, l, mid, nw + sum[x << 1 | 1]);
}
int main() {
  m = read();
  for (int i = 1; i <= m; ++i) {
    int opt, pre;
    pre = read(), opt = read();
    if (opt == 1) {
      ans[pre] = read();
      update(1, 1, m, 1, pre);
    } else
      update(1, 1, m, -1, pre);
    if (mx[1] <= 0)
      puts("-1");
    else
      printf("%d\n", ans[query(1, 1, m, 0)]);
  }
}
