#include <bits/stdc++.h>
using namespace std;
void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
}
const int MAX = 1e5 + 5;
int st[MAX * 3];
int val[MAX];
int lazy[MAX * 3];
int n;
void lazy_prop(int idx, int l, int r) {
  if (lazy[idx]) {
    st[idx] += lazy[idx];
    if (l != r) {
      lazy[idx << 1] += lazy[idx];
      lazy[idx << 1 | 1] += lazy[idx];
    }
    lazy[idx] = 0;
  }
}
void upd(int ql, int qr, int val, int idx = 1, int l = 1, int r = n) {
  lazy_prop(idx, l, r);
  if (ql > r || qr < l) return;
  if (ql <= l && r <= qr) {
    st[idx] += val;
    if (l != r) {
      lazy[idx << 1] += val;
      lazy[idx << 1 | 1] += val;
    }
    return;
  }
  int m = l + (r - l) / 2;
  upd(ql, qr, val, idx << 1, l, m);
  upd(ql, qr, val, idx << 1 | 1, m + 1, r);
  st[idx] = max(st[idx << 1], st[idx << 1 | 1]);
}
int ask(int ql, int qr, int idx = 1, int l = 1, int r = n) {
  lazy_prop(idx, l, r);
  if (ql > r || qr < l) return 0;
  if (ql <= l && r <= qr) return st[idx];
  int m = l + (r - l) / 2;
  return max(ask(ql, qr, idx << 1, l, m), ask(ql, qr, idx << 1 | 1, m + 1, r));
}
int main(int argc, char* argv[]) {
  io();
  cin >> n;
  int p, t, x;
  for (int i = 1; i <= n; i++) {
    cin >> p >> t;
    if (t == 1) {
      cin >> x;
      upd(1, p, 1);
      val[p] = x;
    } else {
      upd(1, p, -1);
    }
    int ans = -1;
    int l, r, mid;
    l = 1, r = n;
    while (l <= r) {
      int mid = l + (r - l) / 2;
      int rsum = ask(mid, n);
      if (rsum >= 1) {
        ans = mid;
        l = mid + 1;
      } else {
        r = mid - 1;
      }
    }
    if (ans == -1)
      cout << -1 << '\n';
    else
      cout << val[ans] << '\n';
  }
  return 0;
}
