#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int offset = 1 << 17;
int vals[MAXN];
class Tournament {
 public:
  int data[offset << 1];
  int flag[offset << 1];
  void propagate(int curr) {
    data[curr] += flag[curr];
    if (curr < offset) {
      flag[curr * 2 + 0] += flag[curr];
      flag[curr * 2 + 1] += flag[curr];
    }
    flag[curr] = 0;
  }
  void update(int curr, int lo, int hi, int from, int to, int val) {
    propagate(curr);
    if (hi <= from || to <= lo) return;
    if (from <= lo && hi <= to) {
      flag[curr] += val;
      propagate(curr);
      return;
    }
    int mid = (lo + hi) / 2;
    update(curr * 2 + 0, lo, mid, from, to, val);
    update(curr * 2 + 1, mid, hi, from, to, val);
    data[curr] = max(data[curr * 2], data[curr * 2 + 1]);
  }
  pair<int, int> query(int curr) {
    propagate(curr);
    if (curr < offset) {
      propagate(curr * 2 + 0);
      propagate(curr * 2 + 1);
    } else {
      return {data[curr], curr};
    }
    if (data[curr * 2] > 0) {
      return query(curr * 2);
    }
    if (data[curr * 2 + 1] > 0) {
      return query(curr * 2 + 1);
    }
    return {0, curr};
  }
} T;
int main() {
  ios_base::sync_with_stdio(false);
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int p, t;
    cin >> p >> t;
    p = m - p;
    if (t == 0) {
      T.update(1, 0, offset, p, m, -1);
    } else {
      T.update(1, 0, offset, p, m, +1);
      cin >> vals[p];
    }
    pair<int, int> rez = T.query(1);
    if (rez.first > 0) {
      cout << vals[rez.second - offset] << endl;
    } else {
      cout << -1 << endl;
    }
  }
  return 0;
}
