#include <bits/stdc++.h>
using namespace std;
int itmax[4 * 100001], it[4 * 100001], p[100001], x[100001], t[100001],
    lazy[4 * 100001], z;
int buildIT(int i, int l, int r, int u, int v, int val) {
  if (lazy[i] && l < r) {
    it[i * 2] += it[i];
    it[i * 2 + 1] += it[i];
    itmax[i * 2] += it[i];
    itmax[i * 2 + 1] += it[i];
    it[i] = 0;
    lazy[i * 2] = 1;
    lazy[i * 2 + 1] = 1;
    lazy[i] = 0;
  }
  if (l > v || r < u) return 0;
  if (u <= l && r <= v) {
    it[i] += val;
    itmax[i] += val;
    lazy[i] = 1;
    return 0;
  }
  int m = (l + r) / 2;
  buildIT(i * 2, l, m, u, v, val);
  buildIT(i * 2 + 1, m + 1, r, u, v, val);
  itmax[i] = max(itmax[i * 2], itmax[i * 2 + 1]);
  return 0;
}
int searchIT(int i, int l, int r) {
  if (lazy[i] && l < r) {
    it[i * 2] += it[i];
    it[i * 2 + 1] += it[i];
    itmax[i * 2] += it[i];
    itmax[i * 2 + 1] += it[i];
    it[i] = 0;
    lazy[i * 2] = 1;
    lazy[i * 2 + 1] = 1;
    lazy[i] = 0;
  }
  if (l == r && itmax[i] > 0) return l;
  int m = (l + r) / 2;
  if (itmax[i * 2 + 1] > 0)
    return searchIT(i * 2 + 1, m + 1, r);
  else if (itmax[i * 2] > 0)
    return searchIT(i * 2, l, m);
  else
    return 0;
}
int main() {
  int n;
  cin >> n;
  x[0] = -1;
  for (int i = 1; i <= n; i++) {
    cin >> p[i] >> t[i];
    if (t[i] == 1) {
      cin >> x[p[i]];
      buildIT(1, 1, n, 1, p[i], 1);
    } else
      buildIT(1, 1, n, 1, p[i], -1);
    z = searchIT(1, 1, n);
    cout << x[z] << endl;
  }
  return 0;
}
