#include <bits/stdc++.h>
using namespace std;
struct Tree {
  const pair<int, int> LOW = {0, 0};
  pair<int, int> f(pair<int, int> a, pair<int, int> b) {
    return {a.first + b.first, max(b.second, a.second + b.first)};
  }
  int n;
  vector<pair<int, int> > s;
  Tree() {}
  Tree(int m, pair<int, int> def = {0, 0}) { init(m, def); }
  void init(int m, pair<int, int> def) {
    n = 1;
    while (n < m) n *= 2;
    s.assign(n + m, def);
    s.resize(2 * n, LOW);
    for (int i = n; i-- > 1;) s[i] = f(s[i * 2], s[i * 2 + 1]);
  }
  void update(int pos, pair<int, int> val) {
    pos += n;
    s[pos] = val;
    for (pos /= 2; pos >= 1; pos /= 2) s[pos] = f(s[pos * 2], s[pos * 2 + 1]);
  }
  pair<int, int> query(int l, int r) { return que(1, l, r, 0, n); }
  pair<int, int> que(int pos, int l, int r, int lo, int hi) {
    if (r <= lo || hi <= l) return LOW;
    if (l <= lo && hi <= r) return s[pos];
    int m = (lo + hi) / 2;
    return f(que(2 * pos, l, r, lo, m), que(2 * pos + 1, l, r, m, hi));
  }
};
int main() {
  int m;
  scanf("%d", &m);
  Tree tree(m + 1);
  vector<int> xx(m + 1);
  for (int i = 0; i < m; i++) {
    int p, t, x;
    scanf("%d %d", &p, &t);
    if (t == 1) {
      scanf("%d", &x);
      xx[p] = x;
    }
    if (t == 1) {
      tree.update(p, {1, 1});
    } else {
      tree.update(p, {-1, -1});
    }
    int lo = 1, hi = m;
    int ans = -1;
    while (lo <= hi) {
      int mid = (lo + hi) / 2;
      if (tree.query(mid, m + 1).second > 0) {
        ans = max(ans, mid);
        lo = mid + 1;
      } else {
        hi = mid - 1;
      }
    }
    if (ans == -1) {
      printf("-1\n");
    } else {
      printf("%d\n", xx[ans]);
    }
  }
}
