#include <bits/stdc++.h>
using namespace std;
int N;
const int NV = 1 << 19;
long long 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, long long int tot = 0) {
  while (cur < NV) {
    cur *= 2;
    if (ma[cur] <= tot) tot -= sum[cur], cur++;
  }
  return cur - NV;
}
void solve() {
  int j, k, l, r, x, y;
  string s;
  cin >> N;
  for (int 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() {
  solve();
  return 0;
}
