#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
const int sqrtN = 320;
int countA[sqrtN], countP[sqrtN];
map<int, int> dm[sqrtN];
void recomp(int ind) {
  int a, p;
  a = p = 0;
  for (auto& x : dm[ind]) {
    if (x.second != -1) {
      if (p != 0)
        p--;
      else
        (a++);
    } else {
      p++;
    }
  }
  countA[ind] = a;
  countP[ind] = p;
}
int getTop(int ind, int p) {
  for (auto& x : dm[ind]) {
    if (x.second != -1) {
      if (p != 0)
        p--;
      else
        return x.second;
    } else {
      p++;
    }
  }
}
int top() {
  int p = 0;
  for (int i = 0; i < sqrtN; ++i) {
    if (p - countA[i] < 0) return getTop(i, p);
    p += countP[i] - countA[i];
  }
  return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int t, type;
    cin >> t >> type;
    int x = -1;
    if (type) cin >> x;
    t = n - t;
    int ind = t / sqrtN;
    dm[ind][t] = x;
    recomp(ind);
    cout << top() << endl;
  }
  return 0;
}
