#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int M = 1e7 + 1;
const unsigned long long INF = 2000000009;
const unsigned long long MOD = 1000 * 1000 * 1000 + 7;
const long double EPS = 1e-9;
int tmin[4 * N], tnum[4 * N];
void recalc(int v, int tl, int tr) {
  if (tl == tr) return;
  tnum[v] = tnum[2 * v + 1] + max(0, tnum[2 * v] - tmin[2 * v + 1]);
  tmin[v] = tmin[2 * v] + max(0, tmin[2 * v + 1] - tnum[2 * v]);
}
void upd(int v, int tl, int tr, int pos, int typ) {
  if (tl == tr) {
    if (typ == 1)
      tnum[v] = 1;
    else
      tmin[v] = 1;
    return;
  }
  int tm = (tl + tr) / 2;
  if (pos <= tm)
    upd(2 * v, tl, tm, pos, typ);
  else
    upd(2 * v + 1, tm + 1, tr, pos, typ);
  recalc(v, tl, tr);
}
int get(int v, int tl, int tr, int add) {
  if (!tnum[v]) return -INF;
  if (tl == tr) return tl;
  int tm = (tl + tr) / 2;
  if (tnum[2 * v + 1] > add)
    return get(2 * v + 1, tm + 1, tr, add);
  else
    return get(2 * v, tl, tm, add + tmin[2 * v + 1] - tnum[2 * v + 1]);
}
int ar[N];
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i1 = 0; i1 < n; ++i1) {
    int p, typ;
    cin >> p >> typ;
    p--;
    if (typ == 1) {
      int x;
      cin >> x;
      upd(1, 0, n - 1, p, 1);
      ar[p] = x;
    } else {
      upd(1, 0, n - 1, p, 0);
    }
    int ans = get(1, 0, n - 1, 0);
    if (ans == -INF)
      cout << -1;
    else
      cout << ar[ans];
    cout << endl;
  }
}
