#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
const int N = 100000 + 5;
int m;
int p[N], t[N], x[N];
int b0[4 * N];
int b1[4 * N];
void update(int v, int tl, int tr, int pos, int val) {
  if (tl == tr) {
    if (val == -1)
      ++b1[v];
    else
      ++b0[v];
    return;
  }
  int tm = (tl + tr) / 2;
  if (pos <= tm)
    update(v + v, tl, tm, pos, val);
  else
    update(v + v + 1, tm + 1, tr, pos, val);
  if (b0[v + v] >= b1[v + v + 1]) {
    b1[v] = b1[v + v];
    b0[v] = b0[v + v] - b1[v + v + 1] + b0[v + v + 1];
  } else {
    b1[v] = b1[v + v] + b1[v + v + 1] - b0[v + v];
    b0[v] = b0[v + v + 1];
  }
}
int X[N];
int get(int v, int tl, int tr, int ind) {
  if (tl == tr) return tl;
  int tm = (tl + tr) / 2;
  if (b0[v + v] >= b1[v + v + 1]) {
    if (b0[v + v] - b1[v + v + 1] >= ind) {
      return get(v + v, tl, tm, ind);
    } else {
      return get(v + v + 1, tm + 1, tr, ind - (b0[v + v] - b1[v + v + 1]));
    }
  } else
    return get(v + v + 1, tm + 1, tr, ind);
}
void solve() {
  scanf("%d", &m);
  for (int i = 1; i <= (int)(m); ++i) {
    scanf("%d%d", &p[i], &t[i]);
    if (t[i]) {
      scanf("%d", &x[i]);
      X[p[i]] = x[i];
    }
  }
  for (int i = 1; i <= (int)(m); ++i) {
    if (t[i] == 0)
      update(1, 1, m, p[i], -1);
    else
      update(1, 1, m, p[i], 1);
    if (!b0[1])
      puts("-1");
    else {
      int ind = get(1, 1, m, b0[1]);
      printf("%d\n", X[ind]);
    }
  }
}
long long rd() { return ((long long)rand() << 16) + rand(); }
void testgen() {
  FILE* f = fopen("input.txt", "w");
  fclose(f);
}
int main() {
  std::cout << std::fixed;
  std::cout.precision(8);
  std::cerr << std::fixed;
  std::cerr.precision(3);
  solve();
  return 0;
}
