#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 17;
int T[MAXN << 2], mini[MAXN << 2], val[MAXN << 2];
void Update(int l, int r, int p, int t, int x, int rt = 1) {
  if (l == r) {
    T[rt] += t;
    mini[rt] = min(T[rt], 0);
    val[rt] = x;
    return;
  }
  int m = (l + r) >> 1;
  if (p <= m)
    Update(l, m, p, t, x, rt << 1);
  else
    Update(m + 1, r, p, t, x, rt << 1 | 1);
  T[rt] = T[rt << 1] + T[rt << 1 | 1];
  mini[rt] = min(mini[rt << 1], mini[rt << 1 | 1] + T[rt << 1]);
}
int Query(int l, int r, int c, int rt = 1) {
  if (l == r) {
    if (c != 1)
      return -1;
    else
      return val[rt];
  }
  int m = (l + r) >> 1;
  if (mini[rt << 1 | 1] + T[rt << 1] < c)
    return Query(m + 1, r, c - T[rt << 1], rt << 1 | 1);
  else
    return Query(l, m, c, rt << 1);
}
int main() {
  int m;
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    int p, t, x = -1;
    cin >> p >> t;
    if (t == 1) cin >> x;
    if (t == 0) t = -1;
    Update(1, m, p, t, x);
    cout << Query(1, m, T[1]) << '\n';
  }
}
