#include <bits/stdc++.h>
using namespace std;
const long long INF = 1ll << 60;
int v[400010], Max[400010], tag[400010];
void Push_Down(int x) {
  if (tag[x] == 0) return;
  Max[x << 1] += tag[x];
  Max[x << 1 | 1] += tag[x];
  tag[x << 1] += tag[x];
  tag[x << 1 | 1] += tag[x];
  tag[x] = 0;
}
void Insert(int x, int L, int R, int l, int r, int c) {
  if (r < L || l > R) return;
  if (l <= L && r >= R) {
    tag[x] += c;
    Max[x] += c;
    return;
  }
  int Mid = (L + R) >> 1;
  Push_Down(x);
  Insert(x << 1, L, Mid, l, r, c);
  Insert(x << 1 | 1, Mid + 1, R, l, r, c);
  Max[x] = max(Max[x << 1], Max[x << 1 | 1]);
}
int Query(int x, int L, int R) {
  if (L == R) return L;
  Push_Down(x);
  int Mid = (L + R) >> 1;
  if (Max[x << 1 | 1] > 0)
    return Query(x << 1 | 1, Mid + 1, R);
  else
    return Query(x << 1, L, Mid);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int op, pos;
    scanf("%d%d", &pos, &op);
    if (op == 0)
      Insert(1, 1, n, 1, pos, -1);
    else {
      scanf("%d", &v[pos]);
      Insert(1, 1, n, 1, pos, 1);
    }
    if (Max[1] <= 0)
      puts("-1");
    else
      printf("%d\n", v[Query(1, 1, n)]);
  }
  return 0;
}
