#include <bits/stdc++.h>
using namespace std;
int tree[4 * 100005], lazy[4 * 100005];
const int INF = 1e6;
int arr[100005];
void push(int node) {
  tree[node * 2] += lazy[node];
  tree[node * 2 + 1] += lazy[node];
  lazy[node * 2] += lazy[node];
  lazy[node * 2 + 1] += lazy[node];
  lazy[node] = 0;
}
void update(int node, int tl, int tr, int l, int r, int val) {
  if (l > r) return;
  if (tl >= l && tr <= r) {
    tree[node] += val;
    lazy[node] += val;
  } else {
    push(node);
    int mid = (tl + tr) / 2;
    update(node * 2, tl, mid, l, min(r, mid), val);
    update(node * 2 + 1, mid + 1, tr, max(l, mid + 1), r, val);
    tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
  }
}
int quary(int node, int tl, int tr) {
  if (tree[node] <= 0) return -1;
  if (tl == tr) {
    if (tree[node] > 0) return tl;
    return -1;
  }
  push(node);
  int mid = (tl + tr) / 2;
  int ret2 = quary(node * 2 + 1, mid + 1, tr);
  if (ret2 > 0) return ret2;
  int ret1 = quary(node * 2, tl, mid);
  return ret1;
}
int main() {
  int i, j, m;
  scanf("%d", &m);
  for (j = 1; j <= m; j++) {
    int p, t, x;
    scanf("%d", &p);
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &x);
      arr[p] = x;
      update(1, 1, m, 1, p, 1);
    } else {
      arr[p] = -1;
      update(1, 1, m, 1, p, -1);
    }
    int pos = quary(1, 1, m);
    if (pos <= 0)
      printf("-1\n");
    else
      printf("%d\n", arr[pos]);
  }
}
