#include <bits/stdc++.h>
using namespace std;
const int N = 300000;
int n, p, typ, x, d[N], c[N], a[N], t[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p >> typ;
    p--;
    if (typ == 1) {
      int l = 0;
      cin >> x;
      a[p] = x;
      while (l + 350 <= p) {
        t[l / 350]++;
        d[l / 350]++;
        l += 350;
      }
      int k = l;
      int dd = l;
      while (l <= p) {
        c[l]++;
        l++;
      }
      d[k / 350] = -1e6;
      while (k <= dd + 350 && k < n) {
        d[k / 350] = max(d[k / 350], c[k] + t[k / 350]);
        k++;
      }
    } else {
      int l = 0;
      while (l + 350 <= p) {
        t[l / 350]--;
        d[l / 350]--;
        l += 350;
      }
      int k = l;
      int dd = l;
      while (l <= p) {
        c[l]--;
        l++;
      }
      d[k / 350] = -1e6;
      while (k <= dd + 350 && k < n) {
        d[k / 350] = max(d[k / 350], c[k] + t[k / 350]);
        k++;
      }
    }
    int l = n / 350 + (n % 350 == 0);
    while (d[l] <= 0 && l >= 0) l--;
    if (l < 0)
      cout << -1 << endl;
    else {
      int k = 350 * l, ans;
      for (int j = k; j < min(k + 350, n); j++)
        if (c[j] + t[l] > 0) ans = j;
      cout << a[ans] << endl;
    }
  }
}
