#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 100002;
int n;
struct SGTNode {
  int mx;
  int lazy;
};
SGTNode SGT[N_MAX * 3];
int v[N_MAX];
void split(int node) {
  int lSon = (node << 1), rSon = (lSon | 1);
  SGT[lSon].mx += SGT[node].lazy;
  SGT[rSon].mx += SGT[node].lazy;
  SGT[lSon].lazy += SGT[node].lazy;
  SGT[rSon].lazy += SGT[node].lazy;
  SGT[node].lazy = 0;
}
void update(int node, int l, int r, int ul, int ur, int uval) {
  if (ul <= l && r <= ur) {
    SGT[node].mx += uval;
    SGT[node].lazy += uval;
    return;
  }
  int mid = ((l + r) >> 1), lSon = (node << 1), rSon = (lSon | 1);
  split(node);
  if (ul <= mid) update(lSon, l, mid, ul, ur, uval);
  if (mid + 1 <= ur) update(rSon, mid + 1, r, ul, ur, uval);
  SGT[node].mx = max(SGT[lSon].mx, SGT[rSon].mx);
}
int query(int node, int l, int r) {
  if (l == r) {
    if (SGT[node].mx > 0) return l;
    return 0;
  }
  int mid = ((l + r) >> 1), lSon = (node << 1), rSon = (lSon | 1);
  split(node);
  if (SGT[rSon].mx > 0) return query(rSon, mid + 1, r);
  return query(lSon, l, mid);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  v[0] = -1;
  for (int i = 1; i <= n; i++) {
    int p, op;
    cin >> p >> op;
    if (op == 0)
      update(1, 1, n, 1, p, -1);
    else {
      cin >> v[p];
      update(1, 1, n, 1, p, 1);
    }
    cout << v[query(1, 1, n)] << "\n";
  }
  return 0;
}
