#include <bits/stdc++.h>
const int N = 131071;
const int MOD = 1e9 + 7;
const int INF = 2e9;
const long long INFLL = 1e18;
const double PI = acos((double)-1);
inline int mult(int a, int b, int p = MOD) { return (1ll * a * b) % p; }
inline int add(int a, int b, int p = MOD) { return (1ll * a + b) % p; }
inline int fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
using namespace std;
pair<int, int> f[N + N];
int a[N], n;
void update(int x, int y) {
  int pos = x + N;
  f[pos].first = y;
  f[pos].second = f[pos].first;
  while (pos != 1) {
    pos /= 2;
    f[pos].first = f[pos * 2].first + f[pos * 2 + 1].first;
    f[pos].second =
        max(f[pos * 2].second, f[pos * 2].first + f[pos * 2 + 1].second);
  }
}
int query() {
  int pos = 1;
  int t = 0;
  while (pos <= N) {
    if (f[pos * 2].second + t > 0)
      pos *= 2;
    else {
      t += f[pos * 2].first;
      pos = pos * 2 + 1;
    }
  }
  return pos - N;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  memset(f, 0, sizeof(f));
  for (int i = 0; i < n; i++) {
    int x, y, id;
    cin >> x;
    cin >> id;
    if (id == 1) {
      cin >> a[x];
      update(n - x + 1, 1);
    } else {
      update(n - x + 1, -1);
    }
    if (f[1].second <= 0) {
      cout << -1 << endl;
      continue;
    } else {
      cout << a[n - query() + 1] << endl;
    }
  }
  return 0;
}
