#include <bits/stdc++.h>
static const int N = 1 << 17;
static const int H = 17;
struct segment_tree {
  int t[N + N];
  int lazy[N + N];
  int n;
  void init(int n_) {
    n = n_;
    memset(t, 0, sizeof(t));
    memset(lazy, 0, sizeof(lazy));
  }
  void apply(int p, int value) {
    t[p] += value;
    if (p < N) lazy[p] += value;
  }
  void apply_lazy(int p) {
    if (int lz = lazy[p]) {
      lazy[p] = 0;
      apply(p << 1, lz);
      apply(p << 1 | 1, lz);
    }
  }
  void build(int p) {
    while (p > 1) {
      p >>= 1;
      t[p] = std::max(t[p << 1], t[p << 1 | 1]) + lazy[p];
    }
  }
  void push(int p) {
    for (int s = H; s > 0; --s) {
      apply_lazy(p >> s);
    }
  }
  void increment(int l, int r, int value) {
    int l0 = l + N, r0 = r + N;
    for (l += N, r += N; l < r; l >>= 1, r >>= 1) {
      if (l & 1) apply(l++, value);
      if (r & 1) apply(--r, value);
    }
    build(l0);
    build(r0 - 1);
  }
  int query() {
    int result = 1;
    while (result < N) {
      apply_lazy(result);
      result <<= 1;
      if (t[result | 1] > 0) ++result;
    }
    if (t[result] <= 0) return -1;
    return result - N;
  }
} tree;
int stack[N];
int solve() {
  int n;
  scanf("%d", &n);
  tree.init(n);
  for (int i = 0; i < n; ++i) {
    int pos, t;
    scanf("%d%d", &pos, &t);
    if (t == 0) {
      tree.increment(0, pos, -1);
    } else {
      int value;
      scanf("%d", &value);
      stack[pos - 1] = value;
      tree.increment(0, pos, +1);
    }
    int ans = tree.query();
    if (ans < 0)
      printf("-1\n");
    else
      printf("%d\n", stack[ans]);
  }
  return 0;
}
int main(int argc, char* argv[]) {
  solve();
  return 0;
}
