#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 100005, second = 320;
int B[second + 4][second + 4], HV[second + 4][2 * second + 4], P[N];
int search(int bn, int v) {
  for (int i = second - 1; i >= 0; i--)
    if (B[bn][i] == v) return ((bn * second) + i);
  return -1;
}
int qry(int n) {
  long long int v = 0, bn = n / second;
  while ((v < -second || v > second || !HV[bn][second + 1 - v]) && bn > 0) {
    v += B[bn][0];
    bn--;
  }
  return search(bn, 1 - v);
}
void updt(int x, int v) {
  int bn = x / second;
  for (int i = x % second; i >= 0; i--) {
    HV[bn][second + B[bn][i]]--, B[bn][i] += v, HV[bn][second + B[bn][i]]++;
  }
}
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int p, t;
    scanf("%d", &p);
    scanf("%d", &t);
    p--;
    if (t == 1)
      scanf("%d", &P[p]), updt(p, 1);
    else
      updt(p, -1);
    x = qry(n);
    if (x == -1)
      printf("%d\n", -1);
    else
      printf("%d\n", P[x]);
  }
  return 0;
}
