#include <bits/stdc++.h>
using namespace std;
template <typename input_type>
input_type input() {
  input_type inp;
  cin >> inp;
  return inp;
}
const int max_sz = 1e5 + 5;
int sz, value, arr[max_sz], sgmnt[max_sz * 4], lazy[max_sz * 4];
pair<int, int> query;
void shift(int ands) {
  pair<int, int> child = {(ands * 2) + 1, (ands * 2) + 2};
  sgmnt[child.first] += lazy[ands], lazy[child.first] += lazy[ands];
  sgmnt[child.second] += lazy[ands], lazy[child.second] += lazy[ands];
  lazy[ands] = 0;
}
void add(int ands, pair<int, int> range) {
  if ((query.second <= range.first) or (range.second <= query.first)) {
    return;
  } else if ((query.first <= range.first) and (range.second <= query.second)) {
    sgmnt[ands] += value, lazy[ands] += value;
    return;
  }
  int mid = (range.first + range.second) / 2;
  pair<int, int> child = {(ands * 2) + 1, (ands * 2) + 2};
  if (lazy[ands] and (range.second - range.first > 1)) {
    shift(ands);
  }
  add(child.first, make_pair(range.first, mid));
  add(child.second, make_pair(mid, range.second));
  sgmnt[ands] = max(sgmnt[child.first], sgmnt[child.second]);
}
int get(int ands, pair<int, int> range) {
  if (range.second - range.first == 1) {
    return range.first;
  }
  int mid = (range.first + range.second) / 2;
  pair<int, int> child = {(ands * 2) + 1, (ands * 2) + 2};
  shift(ands);
  if (sgmnt[child.second] < 1) {
    return get(child.first, make_pair(range.first, mid));
  }
  return get(child.second, make_pair(mid, range.second));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  sz = input<int>();
  for (int i = 0; i < sz; i++) {
    pair<int, bool> opr = {input<int>() - 1, input<bool>()};
    if (opr.second) {
      arr[opr.first] = input<int>();
      value = 1, query = {0, opr.first + 1};
      add(0, make_pair(0, sz));
    } else {
      value = -1, query = {0, opr.first + 1};
      add(0, make_pair(0, sz));
    }
    if (sgmnt[0] < 1) {
      cout << "-1" << endl;
    } else {
      cout << arr[get(0, make_pair(0, sz))] << endl;
    }
  }
  return 0;
}
