#include <bits/stdc++.h>
using namespace std;
int A[200005];
int S[2000005];
int M[2000005];
void update(int v, int l, int r, int pos, int val) {
  if (l == r) {
    S[v] = val;
    M[v] = max(val, 0);
    return;
  }
  int m = (l + r) / 2;
  if (pos <= m)
    update(2 * v + 1, l, m, pos, val);
  else
    update(2 * v + 2, m + 1, r, pos, val);
  S[v] = S[2 * v + 1] + S[2 * v + 2];
  M[v] = max(M[2 * v + 2], S[2 * v + 2] + M[2 * v + 1]);
}
int find(int v, int l, int r, int val) {
  if (l == r) {
    return A[l];
  }
  int m = (l + r) / 2;
  if (M[2 * v + 2] >= val) {
    return find(2 * v + 2, m + 1, r, val);
  } else {
    return find(2 * v + 1, l, m, val - S[2 * v + 2]);
  }
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    int pop_back, t;
    cin >> pop_back >> t;
    pop_back--;
    if (t == 1) {
      int x;
      cin >> x;
      A[pop_back] = x;
    }
    if (t == 1)
      update(0, 0, n - 1, pop_back, 1);
    else
      update(0, 0, n - 1, pop_back, -1);
    int res = -1;
    if (M[0] >= 1) res = find(0, 0, n - 1, 1);
    cout << res << endl;
  }
}
