#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long MOD = 1000000007;
const int INF = 1000000007;
const long long LINF = 1LL * INF * INF;
const int MAXN = 100047;
const double EPS = 1e-6;
int A[MAXN], T[MAXN << 2], P[MAXN << 2];
void push(int v) {
  P[v << 1] += P[v];
  P[(v << 1) + 1] += P[v];
  P[v] = 0;
}
void upd(int v, int tl, int tr, int l, int r, int val) {
  if (l > tr || r < tl) return;
  if (l == tl && r == tr) {
    P[v] += val;
    return;
  }
  push(v);
  int tm = (tl + tr) >> 1;
  upd(v << 1, tl, tm, l, min(r, tm), val);
  upd((v << 1) + 1, tm + 1, tr, max(l, tm + 1), r, val);
  T[v] = max(T[v << 1] + P[v << 1], T[(v << 1) + 1] + P[(v << 1) + 1]);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  A[0] = -1;
  upd(1, 0, n, 0, 0, INF);
  for (int i = (0); i < (n); ++i) {
    int p, t, v = 1, tl = 0, tr = n;
    cin >> p >> t;
    if (t) cin >> A[p];
    upd(1, 0, n, 0, p, (t << 1) - 1);
    while (tl < tr) {
      push(v);
      int tm = (tl + tr) >> 1;
      T[v] = max(T[v << 1] + P[v << 1], T[(v << 1) + 1] + P[(v << 1) + 1]);
      if (T[(v << 1) + 1] + P[(v << 1) + 1] > 0) {
        v = (v << 1) + 1;
        tl = tm + 1;
      } else {
        v = v << 1;
        tr = tm;
      }
    }
    cout << A[tl] << '\n';
  }
  return 0;
}
