#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int m, v[N];
struct Nd {
  int Max, lazy;
  void gao(int f) {
    lazy += f;
    Max += f;
  }
} nd[N * 4];
void pd(int x) {
  if (nd[x].lazy) {
    nd[(x << 1)].gao(nd[x].lazy);
    nd[((x << 1) | 1)].gao(nd[x].lazy);
    nd[x].lazy = 0;
  }
}
void pu(int x) { nd[x].Max = max(nd[(x << 1)].Max, nd[((x << 1) | 1)].Max); }
void add(int l, int r, int w, int L = 1, int R = m, int x = 1) {
  if (l <= L && R <= r) {
    nd[x].gao(w);
    return;
  }
  int mid = (L + R) >> 1;
  pd(x);
  if (l <= mid) add(l, r, w, L, mid, (x << 1));
  if (r > mid) add(l, r, w, mid + 1, R, ((x << 1) | 1));
  pu(x);
}
int go(int L = 1, int R = m, int x = 1) {
  if (L == R) return L;
  int mid = (L + R) >> 1;
  pd(x);
  int ans;
  if (nd[((x << 1) | 1)].Max > 0)
    ans = go(mid + 1, R, ((x << 1) | 1));
  else
    ans = go(L, mid, (x << 1));
  pu(x);
  return ans;
}
int main() {
  scanf("%d", &m);
  int p, t, x;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &p, &t);
    if (t == 0)
      add(1, p, -1);
    else {
      scanf("%d", &v[p]);
      add(1, p, 1);
    }
    if (nd[1].Max <= 0)
      printf("-1\n");
    else
      printf("%d\n", v[go()]);
  }
  return 0;
}
