#include <bits/stdc++.h>
const int MX = 1e5 + 23;
const long long MOD = 998244353;
int read() {
  char k = getchar();
  int x = 0;
  while (k < '0' || k > '9') k = getchar();
  while (k >= '0' && k <= '9') x = x * 10 + k - '0', k = getchar();
  return x;
}
struct node {
  int l, r;
  int sum, mx;
  node *lch, *rch;
} * root;
void pushup(node *x) {
  x->sum = x->lch->sum + x->rch->sum;
  x->mx = std::max(x->lch->mx + x->rch->sum, x->rch->mx);
}
node *build(int l, int r) {
  node *x = new node;
  x->l = l, x->r = r;
  if (l == r) {
    x->sum = x->mx = 0;
    x->lch = x->rch = nullptr;
  } else {
    int mid = (l + r) >> 1;
    x->lch = build(l, mid);
    x->rch = build(mid + 1, r);
    pushup(x);
  }
  return x;
}
void add(node *x, int p, int v) {
  if (x->l == x->r) {
    x->sum += v;
    x->mx += v;
    return;
  }
  if (p <= x->lch->r)
    add(x->lch, p, v);
  else
    add(x->rch, p, v);
  pushup(x);
}
int query(node *x, int ex) {
  if (x->l == x->r) return x->l;
  if (x->rch->mx + ex >= 1) return query(x->rch, ex);
  return query(x->lch, ex + x->rch->sum);
}
int m, w[MX];
int main() {
  root = build(1, 100000 + 233);
  m = read();
  for (int i = 1, type, x, v; i <= m; ++i) {
    x = read(), type = read();
    if (type == 0) {
      add(root, x, -1);
    } else {
      v = read();
      w[x] = v;
      add(root, x, 1);
    }
    if (root->mx <= 0) {
      puts("-1");
    } else {
      printf("%d\n", w[query(root, 0)]);
    }
  }
  return 0;
}
