#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e18;
const long long N = 2e5 + 1;
const long long mod = 1e8 + 0;
const long double eps = 1E-7;
int a[N];
int t[4 * N];
int lz[4 * N];
int n, p, x, y;
void push(int v) {
  if (lz[v] == 0) {
    return;
  } else {
    t[v * 2] += lz[v];
    t[v * 2 + 1] += lz[v];
    lz[v * 2] += lz[v];
    lz[v * 2 + 1] += lz[v];
    lz[v] = 0;
  }
}
void upd(int v, int tl, int tr, int l, int r, int val) {
  if (l > r) {
    return;
  }
  if (tl == l and tr == r) {
    t[v] += val;
    lz[v] += val;
  } else {
    push(v);
    int tm = (tl + tr) / 2;
    upd(v * 2, tl, tm, l, min(tm, r), val);
    upd(v * 2 + 1, tm + 1, tr, max(tm + 1, l), r, val);
    t[v] = max(t[v * 2], t[v * 2 + 1]);
  }
}
int get(int v, int tl, int tr) {
  if (t[v] <= 0) {
    return 0;
  }
  if (tl == tr) {
    return tl;
  } else {
    push(v);
    int tm = (tl + tr) / 2;
    if (t[v * 2 + 1] > 0) {
      return get(v * 2 + 1, tm + 1, tr);
    } else {
      return get(v * 2, tl, tm);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  a[0] = -1;
  for (int i = 1; i <= n; i++) {
    cin >> x >> p;
    if (p == 1) {
      cin >> y;
      a[x] = y;
      upd(1, 1, n, 1, x, 1);
    } else {
      upd(1, 1, n, 1, x, -1);
    }
    p = get(1, 1, n);
    cout << a[p] << endl;
  }
}
