#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
int m;
int num[MAXN + 10];
int tree[4 * MAXN + 10];
int prop[4 * MAXN + 10];
void upd(int cn, int b, int e, int l, int r, int x, int p = 0) {
  if (l <= b && e <= r) {
    tree[cn] += x + p;
    prop[cn] += x + p;
    return;
  }
  if (r < b || l > e) {
    tree[cn] += p;
    prop[cn] += p;
    return;
  }
  p += prop[cn];
  prop[cn] = 0;
  int m = (b + e) / 2;
  upd(2 * cn, b, m, l, r, x, p);
  upd(2 * cn + 1, m + 1, e, l, r, x, p);
  tree[cn] = min(tree[2 * cn], tree[2 * cn + 1]);
}
void upd(int i, int x) { upd(1, 1, m, i, m, x); }
int get(int cn, int b, int e, int l, int r, int p = 0) {
  if (l <= b && e <= r) return tree[cn] + p;
  if (r < b || l > e) return 1e9;
  int m = (b + e) / 2;
  int L = get(2 * cn, b, m, l, r, p + prop[cn]);
  int R = get(2 * cn + 1, m + 1, e, l, r, p + prop[cn]);
  return min(L, R);
}
bool oka(int j) {
  if (j == 0) return 0 < get(1, 1, m, m, m);
  return get(1, 1, m, j, m) < get(1, 1, m, m, m);
}
int solve() {
  int lo = 0, hi = m - 1;
  while (hi - lo > 1) {
    int m = (lo + hi) / 2;
    if (oka(m))
      lo = m;
    else
      hi = m - 1;
  }
  if (oka(hi)) return num[hi + 1];
  if (oka(lo)) return num[lo + 1];
  return -1;
}
int main() {
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int ps, tp;
    scanf("%d%d", &ps, &tp);
    if (tp == 0)
      upd(ps, -1);
    else {
      int x;
      scanf("%d", &x);
      num[ps] = x;
      upd(ps, +1);
    }
    printf("%d\n", solve());
  }
}
