#include <bits/stdc++.h>
using namespace std;
struct no {
  int beg, end, mid, v, cnt, mxsfx;
  no *l, *r;
  no(int beg, int end)
      : beg(beg), end(end), mid((beg + end) >> 1), v(0), cnt(0), mxsfx(0) {
    if (beg != end) l = new no(beg, mid), r = new no(mid + 1, end);
  }
  ~no() {
    if (beg != end) delete l, delete r;
  }
  void upd(int pos, int val) {
    if (beg == end) return void((v = val, cnt = val / abs(val), mxsfx = cnt));
    (pos <= mid ? l : r)->upd(pos, val);
    cnt = l->cnt + r->cnt, mxsfx = max(l->mxsfx + r->cnt, r->mxsfx);
  }
  int get(int off = 0) {
    if (beg == end) return v;
    if (r->mxsfx > off) return r->get(off);
    return l->get(off - r->cnt);
  }
};
int m, p, t, x;
int main() {
  scanf("%d", &m);
  no seg(1, m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d", &p, &t), x = -1;
    if (t == 1) scanf("%d", &x);
    seg.upd(p, x);
    printf("%d	\n", seg.mxsfx > 0 ? seg.get() : -1);
  }
}
