#include <bits/stdc++.h>
using namespace std;
const int maxN = (5e5) + 18;
int m, S[maxN], P[maxN];
int ST[maxN], LP[maxN], check = 0;
void get_down(int id) {
  int left = id * 2, right = left + 1;
  LP[left] += LP[id];
  LP[right] += LP[id];
  ST[left] += LP[id];
  ST[right] += LP[id];
  LP[id] = 0;
}
void update(int id, int l, int r, int u, int v, int k) {
  if (l < r) get_down(id);
  if (u <= l && v >= r) {
    ST[id] += k;
    LP[id] += k;
    return;
  }
  int mid = (l + r) / 2, left = id * 2, right = left + 1;
  if (u <= mid) update(left, l, mid, u, v, k);
  if (v > mid) update(right, mid + 1, r, u, v, k);
  ST[id] = max(ST[left], ST[right]);
}
int get_point(int id, int l, int r) {
  if (l < r) get_down(id);
  int mid = (l + r) / 2, left = id * 2, right = left + 1;
  if (ST[id] > 0) {
    if (l == r) return l;
    if (ST[right] > 0) return get_point(right, mid + 1, r);
    if (ST[left] > 0) return get_point(left, l, mid);
  }
  if (id != 1) return -2;
  return -1;
}
int main() {
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> S[i];
    int a, b;
    cin >> a;
    if (a == 0) {
      update(1, 1, m, 1, S[i], -1);
    } else {
      cin >> P[S[i]];
      update(1, 1, m, 1, S[i], 1);
    }
    int l = get_point(1, 1, m);
    if (l > -1)
      cout << P[l] << endl;
    else
      cout << l << endl;
  }
  return 0;
}
