#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 213;
int ans[N];
struct SegmentTree {
  int tree[4 * N];
  int pushing[4 * N];
  void push(int v) {
    pushing[v + v] += pushing[v];
    pushing[v + v + 1] += pushing[v];
    pushing[v] = 0;
  }
  void add(int v, int tl, int tr, int l, int r, int value) {
    if (l > r) {
      return;
    }
    if (l == tl && r == tr) {
      pushing[v] += value;
      return;
    }
    push(v);
    int mid = (tl + tr) / 2;
    add(v + v, tl, mid, l, min(r, mid), value);
    add(v + v + 1, mid + 1, tr, max(mid + 1, l), r, value);
    tree[v] =
        max(tree[v + v] + pushing[v + v], tree[v + v + 1] + pushing[v + v + 1]);
  }
  int getMax(int v, int tl, int tr, int l, int r) {
    if (l > r) {
      return -1;
    }
    if (tl == l && r == tr) {
      return tree[v] + pushing[v];
    }
    push(v);
    int mid = (tl + tr) / 2;
    int res = max(getMax(v + v, tl, mid, l, min(r, mid)),
                  getMax(v + v + 1, mid + 1, tr, max(mid + 1, l), r));
    tree[v] =
        max(tree[v + v] + pushing[v + v], tree[v + v + 1] + pushing[v + v + 1]);
    return res;
  }
  int getKth(int v, int tl, int tr) {
    if (tl == tr) {
      return tl;
    } else {
      push(v);
      int mid = (tl + tr) / 2;
      int res = 0;
      if (tree[v + v + 1] + pushing[v + v + 1] <= 0) {
        res = getKth(v + v, tl, mid);
      } else {
        res = getKth(v + v + 1, mid + 1, tr);
      }
      tree[v] = max(tree[v + v] + pushing[v + v],
                    tree[v + v + 1] + pushing[v + v + 1]);
      return res;
    }
  }
  int get(int m) {
    if (tree[1] + pushing[1] <= 0) {
      return -1;
    }
    return ans[getKth(1, 1, m)];
  }
} tree;
int main() {
  int m;
  scanf("%d", &m);
  ans[N - 1] = -1;
  for (int i = 0; i < m; ++i) {
    int p, t;
    scanf("%d %d", &p, &t);
    if (t == 1) {
      int v;
      scanf("%d", &v);
      ans[p] = v;
      tree.add(1, 1, m, 1, p, 1);
    } else {
      tree.add(1, 1, m, 1, p, -1);
    }
    printf("%d\n", tree.get(m));
  }
}
