#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 7, SZ = 3 * 1e8;
const long long MODM = 1e9 + 7, INF = 1e18 + 1;
int a[MAXN];
struct Seg {
  int open, close;
};
Seg t[MAXN << 2];
Seg operat(const Seg& a, const Seg& b) {
  Seg res;
  res.close = a.close + b.close;
  res.open = a.open + b.open;
  int c = b.close;
  int o = a.open;
  res.open -= min(c, o);
  res.close -= min(c, o);
  return res;
}
void update(int pos, int x, int v = 1, int tl = 0, int tr = MAXN - 1) {
  if (tl == tr) {
    if (x > 0)
      t[v].open = 1;
    else
      t[v].close = 1;
    return;
  }
  int tm = (tl + tr) >> 1;
  if (pos <= tm) {
    update(pos, x, (v << 1), tl, tm);
  } else {
    update(pos, x, (v << 1) + 1, tm + 1, tr);
  }
  t[v] = operat(t[v << 1], t[(v << 1) + 1]);
}
int get_ans(int v = 1, int tl = 0, int tr = MAXN - 1, int left = 0) {
  if (tl == tr) {
    return a[tl];
  }
  int tm = (tl + tr) >> 1;
  if (t[(v << 1) + 1].open > left) {
    return get_ans((v << 1) + 1, tm + 1, tr, left);
  } else {
    if (t[v << 1].open + t[(v << 1) + 1].open > left + t[(v << 1) + 1].close)
      return get_ans((v << 1), tl, tm,
                     left + t[(v << 1) + 1].close - t[(v << 1) + 1].open);
    else
      return -1;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int p, tt;
    cin >> p >> tt;
    --p;
    int x;
    if (tt == 1) {
      cin >> x;
    } else {
      x = 0;
    }
    update(p, x);
    a[p] = x;
    int q = get_ans();
    if (q == 0) q = -1;
    cout << q << "\n";
  }
  return 0;
}
