#include <bits/stdc++.h>
using namespace std;
long long tree[4 * 100005], lazy[4 * 100005];
const long long inf = 1000 * 1000 * 1000;
void upd(int node, int a, int b, int i, int j, int value) {
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (a != b) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (a > b || a > j || b < i) return;
  if (a >= i && b <= j) {
    tree[node] += value;
    if (a != b) {
      lazy[node * 2] += value;
      lazy[node * 2 + 1] += value;
    }
    return;
  }
  upd(node * 2, a, (a + b) / 2, i, j, value);
  upd(1 + node * 2, 1 + (a + b) / 2, b, i, j, value);
  tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
}
int gt(int node, int a, int b, int i, int j) {
  if (a > b || a > j || b < i) return -inf;
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (a != b) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (a >= i && b <= j) return tree[node];
  int q1 = gt(node * 2, a, (a + b) / 2, i, j);
  int q2 = gt(1 + node * 2, 1 + (a + b) / 2, b, i, j);
  int res = max(q1, q2);
  return res;
}
int n;
int a[100005];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t, type;
    cin >> t >> type;
    if (type == 0) {
      upd(1, 0, n, 0, t, -1);
    } else {
      cin >> a[t];
      upd(1, 0, n, 0, t, 1);
    }
    int left = 0, rt = n;
    while (left < rt) {
      int mid = (left + rt + 1) / 2;
      long long val = gt(1, 0, n, mid, n);
      if (val > 0) {
        left = mid;
      } else {
        rt = mid - 1;
      }
    }
    cout << (left == 0 ? -1 : a[left]) << endl;
  }
  return 0;
}
