#include <bits/stdc++.h>
using namespace std;
int M;
int A[100004];
struct SegmentTreeNode {
  int cur_bal, max_suffix_bal;
  SegmentTreeNode(int val) : cur_bal(val), max_suffix_bal(max(val, 0)) {}
  SegmentTreeNode operator+(const SegmentTreeNode& pR) const {
    SegmentTreeNode res(0);
    res.cur_bal = this->cur_bal + pR.cur_bal;
    res.max_suffix_bal =
        max(pR.max_suffix_bal, this->max_suffix_bal + pR.cur_bal);
    return res;
  }
};
class SegmentTree {
  int N;
  void _build(const vector<int>& A, int node, int L, int R);
  void _update(int idx, int val, int node, int L, int R);
  int _query(int cur_bal, int node, int L, int R) const;

 public:
  vector<SegmentTreeNode> tree;
  SegmentTree(int _N) : N(_N) {
    int NUM_NODES = 4 * N;
    tree = vector<SegmentTreeNode>(NUM_NODES, 0);
  }
  void update(int idx, int val) { _update(idx, val, 1, 0, N - 1); }
  int query() {
    if (tree[1].max_suffix_bal <= 0) return -1;
    return _query(0, 1, 0, N - 1);
  }
};
void SegmentTree::_update(int idx, int val, int node, int L, int R) {
  if (idx < L || idx > R) return;
  if (L == R) {
    tree[node] = SegmentTreeNode(val);
    return;
  }
  _update(idx, val, 2 * node, L, (L + R) / 2);
  _update(idx, val, 2 * node + 1, (L + R) / 2 + 1, R);
  const SegmentTreeNode& pL = tree[2 * node];
  const SegmentTreeNode& pR = tree[2 * node + 1];
  tree[node] = pL + pR;
}
int SegmentTree::_query(int cur_bal, int node, int L, int R) const {
  if (L == R) return L;
  if (tree[2 * node + 1].max_suffix_bal + cur_bal > 0)
    return _query(cur_bal, 2 * node + 1, (L + R) / 2 + 1, R);
  else
    return _query(cur_bal + tree[2 * node + 1].cur_bal, 2 * node, L,
                  (L + R) / 2);
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> M;
  SegmentTree st(M);
  for (int m = (1), _b = (M); m <= _b; ++m) {
    int p, t;
    cin >> p >> t;
    --p;
    if (t == 1) {
      int x;
      cin >> x;
      A[p] = x;
      st.update(p, +1);
    } else {
      st.update(p, -1);
    }
    int k = st.query();
    cout << ((k < 0) ? -1 : A[k]) << '\n';
  }
  return 0;
}
