#include <bits/stdc++.h>
using namespace std;
int m, nums[200110], tr[810000][2];
void ins(int i, int l, int r, int pos, int val) {
  if (r - l == 1) {
    if (val == -1) {
      tr[i][0] = -1;
      tr[i][1] = 1;
    } else {
      tr[i][0] = 1;
      tr[i][1] = 0;
    }
    return;
  }
  int mid = (l + r) / 2;
  if (pos < mid) {
    ins(2 * i, l, mid, pos, val);
  } else {
    ins(2 * i + 1, mid, r, pos, val);
  }
  tr[i][0] = tr[2 * i][0] + tr[2 * i + 1][0];
  tr[i][1] = min(tr[2 * i][1], tr[2 * i + 1][1] + tr[2 * i][0]);
}
int find(int i, int l, int r, int elev) {
  if (r - l == 1) {
    if (elev != 0)
      return -1;
    else
      return nums[l];
  }
  int mid = (l + r) / 2;
  if (elev < tr[2 * i][0] + tr[2 * i + 1][1]) {
    return find(2 * i, l, mid, elev);
  } else {
    return find(2 * i + 1, mid, r, elev - tr[2 * i][0]);
  }
}
int main() {
  scanf("%d", &m);
  for (int i = 0; i < 810000; i++) {
    tr[i][0] = 0;
    tr[i][1] = 0;
  }
  for (int i = 0; i < 100050; i++) {
    nums[i] = -1;
    ins(1, 0, 100050 + m, i, 0);
  }
  for (int i = 0; i < m; i++) {
    int idx, ty;
    scanf("%d %d", &idx, &ty);
    idx += 100050 - 1;
    if (ty) {
      int x;
      scanf("%d", &x);
      ins(1, 0, 100050 + m, idx, x);
      nums[idx] = x;
    } else {
      ins(1, 0, 100050 + m, idx, -1);
    }
    printf("%d\n", find(1, 0, 100050 + m, tr[1][0] - 1));
  }
}
