#include <bits/stdc++.h>
using namespace std;
struct nod {
  int sum, lazy;
} tree[1000006 * 5];
int n, q;
int a[1000006];
void push_up(int id) {
  tree[id].sum = max(tree[(id << 1)].sum, tree[((id << 1) | 1)].sum);
  return;
}
void build_tree(int id, int l, int r) {
  if (l == r) {
    tree[id].lazy = 0;
    return;
  }
  build_tree((id << 1), l, ((l + r) >> 1));
  build_tree(((id << 1) | 1), ((l + r) >> 1) + 1, r);
  push_up(id);
  tree[id].lazy = 0;
  return;
}
void push_down(int id, int l, int r) {
  tree[(id << 1)].sum += tree[id].lazy;
  tree[(id << 1)].lazy += tree[id].lazy;
  tree[((id << 1) | 1)].sum += tree[id].lazy;
  tree[((id << 1) | 1)].lazy += tree[id].lazy;
  tree[id].lazy = 0;
  return;
}
void ins(int id, int l, int r, int ql, int qr, int tt) {
  if (ql <= l && r <= qr) {
    tree[id].sum += tt;
    tree[id].lazy += tt;
    return;
  }
  if (tree[id].lazy) push_down(id, l, r);
  if (ql <= ((l + r) >> 1)) ins((id << 1), l, ((l + r) >> 1), ql, qr, tt);
  if (((l + r) >> 1) + 1 <= qr)
    ins(((id << 1) | 1), ((l + r) >> 1) + 1, r, ql, qr, tt);
  push_up(id);
  return;
}
int query(int id, int l, int r) {
  if (l == r) {
    return l;
  }
  if (tree[id].lazy) push_down(id, l, r);
  int sum;
  if (tree[((id << 1) | 1)].sum > 0)
    sum = query(((id << 1) | 1), ((l + r) >> 1) + 1, r);
  else
    sum = query((id << 1), l, ((l + r) >> 1));
  return sum;
}
int main() {
  int m;
  scanf("%d", &m);
  build_tree(1, 1, 1000000);
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= m; i++) {
    int step, ch;
    scanf("%d%d", &step, &ch);
    if (ch == 1) {
      int x;
      scanf("%d", &x);
      ins(1, 1, 1000000, 1, step, 1);
      a[step] = x;
    } else
      ins(1, 1, 1000000, 1, step, -1);
    if (tree[1].sum > 0) {
      int pos = query(1, 1, 1000000);
      printf("%d\n", a[pos]);
    } else
      printf("-1\n");
  }
  return 0;
}
