#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const int MAXN = 400003;
int ad[MAXN];
int vl[MAXN];
int x[MAXN];
int lv;
void modify_rmq(int v, int l, int r) {
  if (l == r) {
    if (x[l] == 0)
      vl[v] = ad[v] = -1;
    else
      vl[v] = ad[v] = 1;
    return;
  }
  int md = (l + r) / 2;
  if (lv <= md)
    modify_rmq(v * 2 + 1, l, md);
  else
    modify_rmq(v * 2 + 2, md + 1, r);
  ad[v] = ad[v * 2 + 1] + ad[v * 2 + 2];
  vl[v] = max(vl[v * 2 + 2], ad[v * 2 + 2] + vl[v * 2 + 1]);
}
int main() {
  ios_base::sync_with_stdio(0);
  memset(ad, 0, sizeof(ad));
  memset(vl, 0, sizeof(vl));
  memset(x, 0, sizeof(x));
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int tp;
    cin >> lv >> tp;
    if (tp == 1) cin >> x[lv];
    modify_rmq(0, 1, n);
    if (vl[0] <= 0) {
      cout << -1 << "\n";
      continue;
    }
    int v = 0, l = 1, r = n, a = 0;
    while (l != r) {
      int md = (l + r) / 2;
      v = (v * 2 + 2);
      if (vl[v] + a > 0)
        l = md + 1;
      else {
        r = md;
        a += ad[v];
        v--;
      }
    }
    cout << x[l] << "\n";
  }
  return 0;
}
