#include <bits/stdc++.h>
using namespace std;
int a[100009], ele[100009], tree[400020], lazy[400020];
void update(int node, int start, int end, int l, int r, int val) {
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (start != end) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (start > end or start > r or end < l) return;
  if (start >= l and end <= r) {
    tree[node] += val;
    if (start != end) {
      lazy[node * 2] += val;
      lazy[node * 2 + 1] += val;
    }
    return;
  }
  int mid = (start + end) / 2;
  update(node * 2, start, mid, l, r, val);
  update(node * 2 + 1, mid + 1, end, l, r, val);
  tree[node] = max(tree[2 * node], tree[2 * node + 1]);
}
int query(int node, int start, int end, int l, int r) {
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (start != end) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (tree[node] < 1) return -1;
  if (start == end) return ele[start];
  int mid = (start + end) / 2;
  int p1 = query(2 * node + 1, mid + 1, end, l, r);
  if (p1 == -1) p1 = query(2 * node, start, mid, l, r);
  return p1;
}
int main() {
  int n, m, i, j, t1, t2, ans, t3, t4;
  scanf("%d", &m);
  for (i = 0; i < m; i++) {
    scanf("%d %d", &t1, &t2);
    if (t2 == 0) {
      update(1, 0, m - 1, 0, t1 - 1, -1);
    } else {
      scanf("%d", &t3);
      ele[t1 - 1] = t3;
      update(1, 0, m - 1, 0, t1 - 1, 1);
    }
    ans = query(1, 0, m - 1, 0, m - 1);
    printf("%d\n", ans);
  }
  return 0;
}
