#include <bits/stdc++.h>
using namespace std;
struct segment {
  int add, mx;
  segment *l, *r;
  segment(int _l, int _r) {
    if (_l == _r) {
      add = mx = 0;
      l = r = NULL;
      return;
    }
    int m = (_l + _r) / 2;
    l = new segment(_l, m);
    r = new segment(m + 1, _r);
    add = mx = 0;
  }
  void push() {
    if (l != NULL) {
      l->add += add;
      l->mx += add;
    }
    if (r != NULL) {
      r->add += add;
      r->mx += add;
    }
    add = 0;
  }
  void Add(int _l, int _r, int pos, int _val) {
    if (_l > pos) return;
    if (_r <= pos) {
      add += _val;
      mx += _val;
      return;
    }
    push();
    int m = (_l + _r) / 2;
    mx = -1e9;
    if (l != NULL) {
      l->Add(_l, m, pos, _val);
      mx = max(mx, l->mx);
    }
    if (r != NULL) {
      r->Add(m + 1, _r, pos, _val);
      mx = max(mx, r->mx);
    }
  }
  int find(int _l, int _r) {
    if (_l == _r) return _l;
    push();
    if (r != NULL && r->mx > 0) return r->find((_l + _r) / 2 + 1, _r);
    if (l != NULL && l->mx > 0) return l->find(_l, (_l + _r) / 2);
    return -1;
  }
} * tree;
int a[100100];
int main() {
  int m;
  scanf("%d", &m);
  fill(a, a + m + 1, -1);
  tree = new segment(1, m);
  for (int i = 1; i <= m; i++) {
    int p, t, val = -1;
    scanf("%d%d", &p, &t);
    if (t) {
      scanf("%d", &val);
      tree->Add(1, m, p, 1);
    } else {
      tree->Add(1, m, p, -1);
    }
    a[p] = val;
    int id = tree->find(1, m);
    if (id == -1) id = 0;
    printf("%d\n", a[id]);
  }
  return 0;
}
