#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long INF = 1e9;
const int N = 200031;
int n, tp[N], VAL[N], ps[N];
int t[N * 4];
int toadd[N * 4];
void push(int v, int tl, int tr) {
  if (toadd[v] == 0) return;
  t[v * 2] += toadd[v];
  toadd[v * 2] += toadd[v];
  toadd[v * 2 + 1] += toadd[v];
  t[v * 2 + 1] += toadd[v];
  toadd[v] = 0;
}
int get(int v, int tl, int tr, int l, int r) {
  if (l > r) return -1e9;
  if (tl == l && tr == r) return t[v];
  push(v, tl, tr);
  int sdfjahlfasfh = tl + tr;
  sdfjahlfasfh /= 2;
  return max(get(v * 2, tl, sdfjahlfasfh, l, min(r, sdfjahlfasfh)),
             get(v * 2 + 1, sdfjahlfasfh + 1, tr, max(sdfjahlfasfh + 1, l), r));
}
void add(int v, int tl, int tr, int l, int r, int val) {
  if (l > r) return;
  if (tl == l && tr == r) {
    t[v] += val;
    toadd[v] += val;
    return;
  }
  push(v, tl, tr);
  int sdfjahlfasfh = tl + tr;
  sdfjahlfasfh /= 2;
  add(v * 2, tl, sdfjahlfasfh, l, min(r, sdfjahlfasfh), val);
  add(v * 2 + 1, sdfjahlfasfh + 1, tr, max(sdfjahlfasfh + 1, l), r, val);
  t[v] = max(t[v * 2], t[v * 2 + 1]);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &ps[i]);
    scanf("%d", &tp[i]);
    if (tp[i] == 1) {
      scanf("%d", &VAL[ps[i]]);
    }
    if (tp[i] == 0)
      add(1, 1, n, 1, ps[i], -1);
    else
      add(1, 1, n, 1, ps[i], 1);
    if (get(1, 1, n, 1, n) <= 0) {
      printf("%d\n", -1);
      continue;
    }
    int l, r;
    l = 1;
    r = n;
    while (l < r) {
      int mid = l + r + 1;
      mid /= 2;
      if (get(1, 1, n, mid, n) >= 1)
        l = mid;
      else
        r = mid - 1;
    }
    printf("%d\n", VAL[l]);
  }
  cin.get();
  cin.get();
  return 0;
}
