#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(12);
  int m;
  cin >> m;
  int N = 1;
  while (N < m) N *= 2;
  vector<int> tree(2 * N);
  vector<int> tree2(2 * N);
  vector<int> foo(m);
  for (int i = 0; i < m; ++i) {
    int p, t;
    cin >> p >> t;
    if (t == 0) {
      tree[N + p - 1] = 0;
      tree2[N + p - 1] = -1;
    } else {
      int x;
      cin >> x;
      foo[p - 1] = x;
      tree[N + p - 1] = 1;
      tree2[N + p - 1] = 1;
    }
    int j = N + p - 1;
    j /= 2;
    for (; j >= 1; j /= 2) {
      tree2[j] = tree2[2 * j] + tree2[2 * j + 1];
      tree[j] = max(tree[2 * j] + tree2[2 * j + 1], max(tree[2 * j + 1], 0));
    }
    if (tree[1] == 0) {
      cout << "-1\n";
      continue;
    }
    j = 1;
    int offset = 0;
    while (j < N) {
      if (tree[2 * j + 1] + offset > 0) {
        j = 2 * j + 1;
      } else {
        offset += tree2[2 * j + 1];
        j = 2 * j;
      }
    }
    cout << foo[j - N] << "\n";
  }
  return 0;
}
