#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
int c[100001];
int mx[262144], a[262144];
void upd(int node, int S, int E, int k, int cc) {
  if (S == E) {
    mx[node] = a[node] = cc;
    return;
  }
  if (k <= (S + E) / 2)
    upd(node * 2, S, (S + E) / 2, k, cc);
  else
    upd(node * 2 + 1, (S + E) / 2 + 1, E, k, cc);
  a[node] = a[node * 2] + a[node * 2 + 1];
  mx[node] = max(mx[node * 2 + 1], a[node * 2 + 1] + mx[node * 2]);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int(i) = (1); (i) <= (n); (i) += (1)) {
    int p, t, x;
    scanf("%d%d", &p, &t);
    if (t == 1) scanf("%d", c + p);
    upd(1, 1, n, p, t ? 1 : -1);
    if (mx[1] <= 0) {
      puts("-1");
      continue;
    }
    int l = 1, r = n, N = 1, s = 0;
    while (l < r) {
      int k = (l + r) >> 1;
      N = (N * 2 + 1);
      if (mx[N] + s > 0)
        l = k + 1;
      else {
        r = k;
        s += a[N--];
      }
    }
    printf("%d\n", c[l]);
  }
}
