#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vb = vector<bool>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vvvpii = vector<vvpii>;
template <typename T>
T read() {
  T t;
  cin >> t;
  return t;
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& t) {
  o << "{";
  for (int i = int(0); i < int(((int)(t).size())); ++i) o << t[i] << ",";
  o << "}";
  return o;
}
template <class T, class U>
ostream& operator<<(ostream& o, const pair<T, U>& p) {
  return o << '(' << p.first << ", " << p.second << ')';
}
vector<string> __split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
void e_r_r(vector<string>::iterator it) {}
template <typename T, typename... Args>
void e_r_r(vector<string>::iterator it, T a, Args... args) {
  if (*it == " 1" || *it == "1")
    cerr << endl;
  else
    cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << ", ";
  e_r_r(++it, args...);
}
template <typename V>
struct SegTreeLazy {
  static const V zero = 0;
  static const V def = 0;
  struct Node {
    V dat;
    V lazy;
    bool flag;
    Node() : dat(def), lazy(zero), flag(false) {}
  };
  static V merge(const V& l, const V& r) { return max(l, r); }
  const int N;
  vector<Node> seg;
  SegTreeLazy(int size) : N(p2(size)), seg(N * 2){};
  void update(int a, int b, V v) { update(a, b, v, 0, 0, N); }
  V query(int a, int b) { return query(a, b, 0, 0, N); }

 private:
  void push(int k, int l, int r) {
    if (seg[k].flag) {
      seg[k].dat += seg[k].lazy;
      if (r - l > 1) {
        seg[k * 2 + 1].lazy += seg[k].lazy;
        seg[k * 2 + 2].lazy += seg[k].lazy;
        seg[k * 2 + 1].flag = true;
        seg[k * 2 + 2].flag = true;
      }
      seg[k].lazy = zero;
      seg[k].flag = false;
    }
  }
  void update(int a, int b, V v, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      seg[k].lazy = v;
      seg[k].flag = true;
      push(k, l, r);
    } else {
      update(a, b, v, k * 2 + 1, l, (l + r) / 2);
      update(a, b, v, k * 2 + 2, (l + r) / 2, r);
      seg[k].dat = merge(seg[k * 2 + 1].dat, seg[k * 2 + 2].dat);
    }
  }
  V query(int a, int b, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return zero;
    if (a <= l && r <= b) return seg[k].dat;
    V x = query(a, b, k * 2 + 1, l, (l + r) / 2);
    V y = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return merge(x, y);
  }
  static int p2(int n, int m = 1) { return m >= n ? m : p2(n, m * 2); }
};
void Main() {
  int n = read<int>();
  SegTreeLazy<int> seg(n);
  vi P(n);
  for (int i = int(0); i < int(n); ++i) {
    int p = read<int>() - 1;
    int t = read<int>();
    if (t == 1) {
      seg.update(0, p + 1, 1);
      int x = read<int>();
      P[p] = x;
    } else {
      seg.update(0, p + 1, -1);
    }
    {
      int ok = n + 1;
      int ng = 0;
      auto check = [&](int x) -> bool { return seg.query(n - x, n) > 0; };
      while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        bool c = check(mid);
        if (c)
          ok = mid;
        else
          ng = mid;
      }
      if (ok == n + 1)
        cout << -1 << endl;
      else
        cout << P[n - ok] << endl;
    }
  }
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  Main();
  return 0;
}
