#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 17;
int a[MAXN], m, lazy[MAXN << 2], seg[MAXN << 2];
void relax(int v) {
  seg[v << 1] += lazy[v];
  seg[v << 1 | 1] += lazy[v];
  lazy[v << 1] += lazy[v];
  lazy[v << 1 | 1] += lazy[v];
  lazy[v] = 0;
}
void add(int lp, int rp, int val, int v = 1, int l = 1, int r = m + 1) {
  if (rp <= l || r <= lp) return;
  if (lp <= l && r <= rp) {
    seg[v] += val;
    lazy[v] += val;
    return;
  }
  relax(v);
  add(lp, rp, val, v << 1, l, l + r >> 1);
  add(lp, rp, val, v << 1 | 1, l + r >> 1, r);
  seg[v] = max(seg[v << 1], seg[v << 1 | 1]);
}
int get(int v = 1, int l = 1, int r = m + 1) {
  if (l + 1 == r) return l;
  relax(v);
  if (seg[v << 1 | 1] > 0)
    return get(v << 1 | 1, l + r >> 1, r);
  else
    return get(v << 1, l, l + r >> 1);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int p, t, x;
    cin >> p >> t;
    if (t == 0)
      add(1, p + 1, -1);
    else {
      cin >> x;
      add(1, p + 1, 1);
      a[p] = x;
    }
    if (seg[1] <= 0)
      cout << -1 << endl;
    else
      cout << a[get()] << endl;
  }
  return 0;
}
