#include <bits/stdc++.h>
using namespace std;
int s[1000100], tag[1000100], val[1000100], n;
void pushdown(int id, int l, int r) {
  if (!tag[id]) return;
  if (l != r) {
    int mid = (l + r) >> 1;
    int ls = id << 1, rs = id << 1 | 1;
    s[ls] += tag[id];
    s[rs] += tag[id];
    tag[ls] += tag[id];
    tag[rs] += tag[id];
  }
  tag[id] = 0;
}
void add(int id, int l, int r, int num, int tim) {
  pushdown(id, l, r);
  if (l > tim) return;
  if (r <= tim) {
    s[id] += num;
    tag[id] += num;
    return;
  }
  int mid = (l + r) >> 1;
  add(id << 1, l, mid, num, tim);
  add(id << 1 | 1, mid + 1, r, num, tim);
  s[id] = max(s[id << 1], s[id << 1 | 1]);
}
int find(int id, int l, int r) {
  pushdown(id, l, r);
  if (l == r) return val[l];
  int mid = (l + r) >> 1;
  if (s[id << 1 | 1] > 0)
    return find(id << 1 | 1, mid + 1, r);
  else
    return find(id << 1, l, mid);
}
int main() {
  scanf("%d", &n);
  int i;
  memset(s, 0, sizeof(s));
  memset(tag, 0, sizeof(tag));
  for (i = 1; i <= n; i++) {
    int t, p;
    scanf("%d%d", &t, &p);
    if (p == 0)
      add(1, 1, n, -1, t);
    else {
      int num;
      scanf("%d", &num);
      val[t] = num;
      add(1, 1, n, 1, t);
    }
    if (s[1] <= 0)
      printf("-1\n");
    else
      printf("%d\n", find(1, 1, n));
  }
  return 0;
}
