#include <bits/stdc++.h>
using namespace std;
long long const INF = 1e9;
long long const MOD = 1e9 + 7;
vector<long long> t, a;
long long N;
long long l_son(long long x) { return 2 * x + 1; }
long long r_son(long long x) { return 2 * x + 2; }
long long relax(long long a, long long b) { max(t[a], t[b]); }
void push(long long v, long long L, long long R) {
  if (a[v] == 0) {
    return;
  }
  t[l_son(v)] += a[v];
  a[l_son(v)] += a[v];
  a[r_son(v)] += a[v];
  t[r_son(v)] += a[v];
  a[v] = 0;
}
long long query(long long l, long long r, long long v = 0, long long L = 0,
                long long R = N) {
  if (l <= L && r >= R) {
    return t[v];
  }
  if (r <= L || l >= R) {
    return -INF;
  }
  push(v, L, R);
  long long M = (R - L) / 2 + L;
  auto m1 = query(l, r, l_son(v), L, M);
  auto m2 = query(l, r, r_son(v), M, R);
  return max(m1, m2);
}
void add(long long l, long long r, long long d, long long v = 0,
         long long L = 0, long long R = N) {
  if (l <= L && r >= R) {
    t[v] += d;
    a[v] += d;
    return;
  }
  if (r <= L || l >= R) {
    return;
  }
  push(v, L, R);
  long long M = (R - L) / 2 + L;
  add(l, r, d, l_son(v), L, M);
  add(l, r, d, r_son(v), M, R);
  t[v] = max(t[l_son(v)], t[r_son(v)]);
}
void solve() {
  cin >> N;
  long long n = N;
  t.resize(N * 4);
  a.resize(N * 4);
  long long k = N;
  vector<long long> x(N + 1);
  while (k--) {
    long long p, t;
    cin >> p >> t;
    p--;
    if (t == 0) {
      add(0, p + 1, -1);
    }
    if (t == 1) {
      cin >> x[p];
      add(0, p + 1, 1);
    }
    long long to = query(0, n);
    if (to <= 0) {
      cout << -1 << endl;
      continue;
    }
    long long l = 0, r = N;
    while (r - l > 1) {
      long long m = (l + r) / 2;
      to = query(m, n);
      if (to > 0) {
        l = m;
      } else {
        r = m;
      }
    }
    cout << x[l] << endl;
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(32);
  long long t = 1;
  while (t--) {
    solve();
    cout << endl;
  }
  return 0;
}
