#include <bits/stdc++.h>
using namespace std;
int* tbl = new int[1000000];
int* atb = new int[1000000];
void ct(int cl, int cr, int ci) {
  tbl[ci] = 0;
  atb[ci] = 0;
  if (cl == cr) {
    return;
  }
  int cm = (cl + cr) / 2;
  ct(cl, cm, ci * 2);
  ct(cm + 1, cr, ci * 2 + 1);
}
void ut(int cl, int cr, int ci, int sp, int vta) {
  int li = ci * 2;
  int ri = li + 1;
  tbl[ci] += atb[ci];
  atb[li] += atb[ci];
  atb[ri] += atb[ci];
  atb[ci] = 0;
  if (cl > sp) {
    return;
  }
  if (cl == cr) {
    tbl[ci] += vta;
    return;
  }
  int cm = (cl + cr) / 2;
  if (cr <= sp) {
    tbl[ci] += vta;
    atb[li] += vta;
    atb[ri] += vta;
    return;
  }
  ut(cl, cm, li, sp, vta);
  ut(cm + 1, cr, ri, sp, vta);
  tbl[ci] = max(tbl[li], tbl[ri]);
}
int ir(int cl, int cr, int ci) {
  int li = ci * 2;
  int ri = li + 1;
  tbl[ci] += atb[ci];
  atb[li] += atb[ci];
  atb[ri] += atb[ci];
  atb[ci] = 0;
  if (tbl[ci] <= 0) {
    return -1;
  }
  if (cl == cr) {
    return cl;
  }
  int cm = (cl + cr) / 2;
  int lv = tbl[li] + atb[li];
  int rv = tbl[ri] + atb[ri];
  if (rv > 0) {
    return ir(cm + 1, cr, ri);
  }
  return ir(cl, cm, li);
}
int main() {
  int n;
  cin >> n;
  int ar[n];
  ct(0, n - 1, 1);
  for (int i = 0; i < n; i++) {
    int ind, o;
    cin >> ind >> o;
    ind--;
    if (o == 1) {
      int vl;
      cin >> vl;
      ar[ind] = vl;
      ut(0, n - 1, 1, ind, 1);
    } else {
      ut(0, n - 1, 1, ind, -1);
    }
    int pi = ir(0, n - 1, 1);
    if (pi < 0) {
      cout << -1 << endl;
      continue;
    }
    cout << ar[pi] << endl;
  }
  cin >> n;
}
