#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
long long n;
vector<int> v;
pair<int, int> tree[4 * (int)1e5 + 5];
void update(int pos, int val, int l, int h, int p) {
  if (l == h && pos == l) {
    if (val == 0) {
      tree[p].first = 1;
    } else {
      tree[p].second = 1;
    }
    return;
  }
  if (l > pos || h < pos) return;
  int mid = (l + h) >> 1;
  update(pos, val, l, mid, p * 2 + 1);
  update(pos, val, mid + 1, h, p * 2 + 2);
  pair<int, int> &c1 = tree[p * 2 + 1];
  pair<int, int> &c2 = tree[p * 2 + 2];
  if (c1.second >= c2.first) {
    tree[p].first = c1.first;
    tree[p].second = c1.second - c2.first + c2.second;
  } else {
    tree[p].first = c1.first + c2.first - c1.second;
    tree[p].second = c2.second;
  }
  return;
}
int get(int l, int h, int p, int neg) {
  if (l == h) return v[l];
  int mid = (l + h) / 2;
  if (tree[p].second - neg > 0) {
    if (tree[2 * p + 2].second - neg > 0) {
      return get(mid + 1, h, 2 * p + 2, neg);
    } else
      return get(l, mid, 2 * p + 1,
                 neg + tree[2 * p + 2].first - tree[2 * p + 2].second);
  }
}
int main() {
  cin >> n;
  v.resize(n);
  for (int i = 0; i < n; i++) {
    int a, b, x;
    cin >> a >> b;
    if (b == 1) {
      cin >> x;
      v[a - 1] = x;
      update(a - 1, x, 0, n - 1, 0);
    } else {
      update(a - 1, 0, 0, n - 1, 0);
    }
    if (tree[0].second > 0) {
      cout << get(0, n - 1, 0, 0) << endl;
    } else {
      cout << -1 << endl;
    }
  }
}
