#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int lx = 1 << 17;
int n, a[lx], m[lx << 1], sum[lx << 1];
int main() {
  int i, j, k, l;
  n = read();
  while (n--) {
    i = read();
    j = read();
    if (j) {
      k = read();
      a[i] = k;
      sum[i + lx] = 1;
    } else
      sum[i + lx] = -1;
    for (l = (i + lx) >> 1; l; l >>= 1) {
      sum[l] = sum[l << 1] + sum[l << 1 | 1];
      m[l] = min(m[l << 1], sum[l << 1] + m[l << 1 | 1]);
    }
    k = sum[1] - 1;
    if (m[1] > k) {
      printf("-1\n");
      continue;
    }
    for (l = 1; l < lx;) {
      if (sum[l << 1] + m[l << 1 | 1] > k)
        l <<= 1;
      else {
        k -= sum[l << 1];
        l = l << 1 | 1;
      }
    }
    cout << a[l - lx] << endl;
  }
  return 0;
}
