#include <bits/stdc++.h>
using namespace std;
vector<long long> l, r, mn, tad;
void ad(long long a, long long b, long long v, long long id) {
  if (b < l[id] || a > r[id]) return;
  if (a <= l[id] && b >= r[id]) {
    mn[id] += v;
    tad[id] += v;
    return;
  }
  if (tad[id]) {
    ad(l[id], r[id], tad[id], 2 * id);
    ad(l[id], r[id], tad[id], 2 * id + 1);
    tad[id] = 0;
  }
  ad(a, b, v, 2 * id);
  ad(a, b, v, 2 * id + 1);
  mn[id] = min(mn[2 * id], mn[2 * id + 1]);
}
bool qr(long long& tt, long long id) {
  if (id == 1 && mn[id] >= 0) return 0;
  if (l[id] == r[id]) {
    tt = l[id];
    return 1;
  }
  if (tad[id]) {
    ad(l[id], r[id], tad[id], 2 * id);
    ad(l[id], r[id], tad[id], 2 * id + 1);
    tad[id] = 0;
    mn[id] = min(mn[2 * id], mn[2 * id + 1]);
  }
  if (mn[2 * id + 1] < 0) {
    qr(tt, 2 * id + 1);
    return 1;
  }
  qr(tt, 2 * id);
  return 1;
}
void build(long long m) {
  while (m & (m - 1)) ++m;
  l = r = tad = mn = vector<long long>(2 * m);
  for (long long i = 0; i < (m); ++i) {
    l[i + m] = r[i + m] = i;
  }
  for (long long i = m - 1; i >= 1; --i) {
    l[i] = l[2 * i];
    r[i] = r[2 * i + 1];
  }
}
vector<long long> idof;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long m;
  cin >> m;
  build(m);
  idof.resize(m);
  long long p, t;
  long long tt;
  for (long long z = 0; z < (m); ++z) {
    cin >> p >> t;
    --p;
    if (t == 0) {
      ad(0, p, 1, 1);
    } else {
      cin >> idof[p];
      ad(0, p, -1, 1);
    }
    if (qr(tt, 1))
      cout << idof[tt] << "\n";
    else
      cout << -1 << "\n";
  }
  return 0;
}
