#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int val[maxn];
struct Segment_tree {
  int tree[maxn << 2], add[maxn << 2];
  void pushdown(int root) {
    if (add[root]) {
      tree[root << 1] += add[root];
      tree[root << 1 | 1] += add[root];
      add[root << 1 | 1] += add[root];
      add[root << 1] += add[root];
      add[root] = 0;
    }
  }
  void modify(int root, int l, int r, int ql, int qr, int val) {
    if (l >= ql && r <= qr) {
      tree[root] += val;
      add[root] += val;
      return;
    }
    pushdown(root);
    int mid = l + r >> 1;
    if (ql <= mid) modify(root << 1, l, mid, ql, qr, val);
    if (qr > mid) modify(root << 1 | 1, mid + 1, r, ql, qr, val);
    tree[root] = max(tree[root << 1], tree[root << 1 | 1]);
  }
  int query(int root, int l, int r) {
    if (tree[root] <= 0) return 0;
    if (l == r) return l;
    pushdown(root);
    int mid = l + r >> 1;
    if (tree[root << 1 | 1] > 0) {
      return query(root << 1 | 1, mid + 1, r);
    } else
      return query(root << 1, l, mid);
  }
} sg;
int main() {
  int n;
  scanf("%d", &n);
  int id, opt, x;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &id, &opt);
    if (opt == 0) {
      sg.modify(1, 1, n, 1, id, -1);
    } else {
      scanf("%d", &x);
      val[id] = x;
      sg.modify(1, 1, n, 1, id, 1);
    }
    int tmp = sg.query(1, 1, n);
    if (tmp == 0)
      printf("-1\n");
    else
      printf("%d\n", val[tmp]);
  }
  return 0;
}
