#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
int upmax(T1 &x, T2 v) {
  if (x >= v) return 0;
  x = v;
  return 1;
}
const int BSZ = 333;
int b2popcnt[BSZ];
int b2pushcnt[BSZ];
int b[BSZ][BSZ];
int b2maxsfx[BSZ];
const int MAXM = (int)1e5;
int M;
int val[MAXM];
signed main() {
  ios::sync_with_stdio(0);
  cin >> M;
  for (int qi = 0; qi < M; ++qi) {
    int idx;
    cin >> idx;
    --idx;
    int bid = idx / BSZ;
    int id = idx % BSZ;
    int op;
    cin >> op;
    if (op == 0) {
      ++b2popcnt[bid];
      --b[bid][id];
    } else {
      int x;
      cin >> x;
      ++b2pushcnt[bid];
      ++b[bid][id];
      val[idx] = x;
    }
    b2maxsfx[bid] = 0;
    for (int i = BSZ - 1, s = 0; i >= 0; --i) {
      s += b[bid][i];
      upmax(b2maxsfx[bid], s);
    }
    int ans = -1;
    for (int i = BSZ - 1, s = 0; i >= 0; --i) {
      if (s + b2maxsfx[i] > 0) {
        for (int j = BSZ - 1; j >= 0; --j) {
          s += b[i][j];
          if (s > 0) {
            ans = val[i * BSZ + j];
            break;
          }
        }
        break;
      }
      s += b2pushcnt[i] - b2popcnt[i];
    }
    cout << ans << endl;
  }
  return 0;
}
