#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
bool MinPlace(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool MaxPlace(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename S, typename T>
ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  for (int i = 0; i < (int)v.size(); i++) {
    out << v[i];
    if (i != (int)v.size() - 1) out << ", ";
  }
  out << "]";
  return out;
}
template <typename T>
class SegTmax {
  class Node {
   public:
    Node *l;
    Node *r;
    T maxm, lazy;
    int lo, hi;
    Node(int lo, int hi) : lo(lo), hi(hi), lazy(0) {}
    void set(T maxm, T lazy = 0) {
      this->maxm = maxm;
      this->lazy = lazy;
    }
  };

 public:
  int n;
  Node *root;
  SegTmax(int n, vector<T> &init) : n(n) { build(root, 1, n, init); }
  SegTmax(int n) : n(n) {
    vector<T> init(n + 1, 0);
    build(root, 1, n, init);
  }
  void build(Node *&v, int lo, int hi, vector<T> &init) {
    v = new Node(lo, hi);
    if (lo == hi) {
      v->set(init[lo], 0);
      return;
    }
    int mid = (lo + hi) / 2;
    build(v->l, lo, mid, init);
    build(v->r, mid + 1, hi, init);
    merge(v);
  }
  void merge(Node *v) { merge(v, v->l, v->r); }
  void merge(Node *v, Node *l, Node *r) {
    v->set(max(l->maxm + l->lazy, r->maxm + r->lazy), 0);
  }
  void push(Node *v) {
    if (!v->lazy || !v->l) return;
    Node *l = v->l, *r = v->r;
    l->lazy += v->lazy;
    r->lazy += v->lazy;
  }
  void iupd(int lo, int hi, T val, Node *v) {
    if (lo > v->hi || hi < v->lo) return;
    if (lo <= v->lo and hi >= v->hi)
      v->lazy += val;
    else {
      push(v);
      iupd(lo, hi, val, v->l);
      iupd(lo, hi, val, v->r);
      merge(v);
    }
  }
  void upd(int lo, int hi, T val) {
    if (lo > hi) return;
    iupd(lo, hi, val, root);
  }
  int ibinSearch(Node *v, T val) {
    if (v->lo == v->hi) return v->lo;
    push(v);
    merge(v);
    return ibinSearch(((v->r->maxm + v->r->lazy >= val) ? v->r : v->l), val);
  }
  int binSearch(T val) {
    if (root->maxm + root->lazy < val) return -1;
    return ibinSearch(root, val);
  }
  void iprint(Node *v) {
    if (!v) return;
    cout << "[ " << v->lo << " : " << v->hi << " ], " << v->maxm
         << ", lazy = " << v->lazy << "\n";
    iprint(v->l);
    iprint(v->r);
  }
  void print() { iprint(root); }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int m;
  cin >> m;
  vector<int> p(m + 1), t(m + 1), x(m + 1), init(m + 1, 0);
  for (int i = 1; i <= m; i++) {
    cin >> p[i] >> t[i];
    if (t[i]) {
      cin >> x[p[i]];
      init[p[i]] = 1;
    } else
      init[p[i]] = -1;
  }
  for (int i = m - 1; i; i--) init[i] += init[i + 1];
  SegTmax<int> seg(m, init);
  vector<int> output(m + 1, 0);
  for (int i = m; i; i--) {
    int val = seg.binSearch(1);
    if (val != -1) val = x[val];
    output[i] = val;
    seg.upd(1, p[i], (t[i] ? -1 : 1));
  }
  for (int i = 1; i <= m; i++) cout << output[i] << "\n";
};
