#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:200000000")
const double EPS = 1E-9;
const int INF = 1000000000;
const long long INF64 = (long long)1E18;
const double PI = 3.1415926535897932384626433832795;
struct state {
  int pops, size;
};
state md[1100000];
bool mem[1100000];
int a[1100000], val[1100000];
void recalc(int idx, int l, int r) {
  if (l == r) {
    if (!mem[l]) {
      md[idx].pops = md[idx].size = 0;
    } else if (val[l] == -1) {
      md[idx].pops = 1;
      md[idx].size = 0;
    } else {
      md[idx].pops = 0;
      md[idx].size = 1;
    }
    return;
  }
  int delta = md[idx << 1].size - md[idx << 1 | 1].pops;
  if (delta >= 0) {
    md[idx].size = delta + md[idx << 1 | 1].size;
    md[idx].pops = md[idx << 1].pops;
  } else {
    md[idx].size = md[idx << 1 | 1].size;
    md[idx].pops = md[idx << 1].pops - delta;
  }
}
void build(int idx, int l, int r) {
  if (l != r) {
    int mid = (l + r) >> 1;
    build(idx << 1, l, mid);
    build(idx << 1 | 1, mid + 1, r);
  }
  recalc(idx, l, r);
}
void update(int idx, int l, int r, int pos) {
  if (l != r) {
    int mid = (l + r) >> 1;
    if (pos <= mid)
      update(idx << 1, l, mid, pos);
    else
      update(idx << 1 | 1, mid + 1, r, pos);
  }
  recalc(idx, l, r);
}
int get(int idx, int l, int r, int pops) {
  if (md[idx].size <= pops) return -1;
  if (l == r) {
    if (!mem[l] || val[l] == -1) throw;
    return val[l];
  }
  int mid = (l + r) >> 1;
  int res = get(idx << 1 | 1, mid + 1, r, pops);
  if (res == -1)
    res = get(idx << 1, l, mid,
              pops - md[idx << 1 | 1].size + md[idx << 1 | 1].pops);
  return res;
}
int main() {
  int m;
  scanf("%d", &m);
  for (int i = 0; i < (int)(m); i++) {
    int p, t;
    scanf("%d %d", &p, &t);
    p--;
    a[i] = p;
    if (t == 1)
      scanf("%d", &val[p]);
    else
      val[p] = -1;
  }
  build(1, 0, m - 1);
  for (int i = 0; i < (int)(m); i++) {
    mem[a[i]] = true;
    update(1, 0, m - 1, a[i]);
    printf("%d\n", get(1, 0, m - 1, 0));
  }
  return 0;
}
