#include <bits/stdc++.h>
using namespace std;
int N;
const int NV = 1 << 19;
int sum[2 * NV], ma[2 * NV];
int V[202020];
void add(int cur, int v) {
  cur += NV;
  sum[cur] = ma[cur] = v;
  while (cur > 1)
    cur >>= 1, sum[cur] = sum[2 * cur] + sum[2 * cur + 1],
               ma[cur] = max(ma[2 * cur], sum[2 * cur] + ma[2 * cur + 1]);
}
int query(int cur) {
  int tot = 0;
  while (cur < NV) {
    cur *= 2;
    if (ma[cur] <= tot) tot -= sum[cur], cur++;
  }
  return cur - NV;
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N;
  for (i = 0; i < (N); i++) {
    cin >> x >> j;
    x = N + 1 - x;
    if (j == 1) {
      cin >> V[x];
      add(x, 1);
    } else {
      add(x, -1);
    }
    if (ma[1] <= 0)
      cout << -1 << endl;
    else
      cout << V[query(1)] << endl;
    ;
  }
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}
