#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 7;
int n, m;
int tree[4 * MAX], lazy[4 * MAX];
int a[MAX];
void LAZY(int beg, int last, int si) {
  tree[si] += lazy[si];
  if (beg != last) {
    lazy[2 * si + 2] += lazy[si];
    lazy[2 * si + 1] += lazy[si];
  }
  lazy[si] = 0;
}
void update(int beg, int last, int p, int q, int val, int si) {
  LAZY(beg, last, si);
  if (beg > q || last < p) return;
  if (p <= beg && q >= last) {
    lazy[si] = val;
    LAZY(beg, last, si);
    return;
  }
  update(beg, (beg + last) / 2, p, q, val, 2 * si + 1);
  update((beg + last) / 2 + 1, last, p, q, val, 2 * si + 2);
  tree[si] = max(tree[2 * si + 1], tree[2 * si + 2]);
}
int query(int beg, int last, int p, int q, int si) {
  if (beg > q || last < p) return -1;
  LAZY(beg, last, si);
  if (tree[si] <= 0) return -1;
  if (beg == last) return beg;
  int ans = query((beg + last) / 2 + 1, last, p, q, 2 * si + 2);
  if (ans != -1) return ans;
  return query(beg, (beg + last) / 2, p, q, 2 * si + 1);
}
int main() {
  scanf("%d", &m);
  n = m;
  while (m--) {
    int no, type;
    scanf("%d%d", &no, &type);
    int x;
    if (type == 1) {
      scanf("%d", &x);
      a[no] = x;
      update(0, n, 0, no, 1, 0);
    } else
      update(0, n, 0, no, -1, 0);
    int ans = query(0, n, 0, n, 0);
    printf("%d\n", ans == -1 ? -1 : a[ans]);
  }
  return 0;
}
