#include <bits/stdc++.h>
using namespace std;
long long int powmod(long long int a, long long int e) {
  if (e == 0) return 1;
  long long int x = powmod(a * a % 1000000007, e >> 1);
  return e & 1 ? x * a % 1000000007 : x;
}
int lazy[4 * (long long int)100001];
int seg[4 * (long long int)100001];
void update(int low, int high, int index, int bit, int l, int h) {
  if (lazy[index]) {
    seg[index] += lazy[index];
    if (low != high) {
      lazy[index + index + 1] += lazy[index];
      lazy[index + index + 2] += lazy[index];
    }
    lazy[index] = 0;
  }
  if (low > high or h < low or l > high) return;
  if (low >= l and high <= h) {
    seg[index] += bit;
    if (low != high) {
      lazy[index + index + 1] += bit;
      lazy[index + index + 2] += bit;
    }
    return;
  }
  int mid = (low + high) / 2;
  update(low, mid, index + index + 1, bit, l, h);
  update(mid + 1, high, index + index + 2, bit, l, h);
  seg[index] = max(seg[index + index + 1], seg[index + index + 2]);
}
int query(int low, int high, int index) {
  if (lazy[index]) {
    seg[index] += lazy[index];
    if (low != high) {
      lazy[index + index + 1] += lazy[index];
      lazy[index + index + 2] += lazy[index];
    }
    lazy[index] = 0;
  }
  if (seg[index] <= 0) return (int)1e9;
  if (low == high) return low;
  int mid = (low + high) / 2;
  int flag = query(low, mid, index + index + 1);
  if (flag != (int)1e9) return flag;
  return query(mid + 1, high, index + index + 2);
}
int a[(long long int)100001 + 2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int m;
  cin >> m;
  for (long long int i = 0; i < m; i++) {
    int p, t;
    cin >> p >> t;
    p--;
    p = m - 1 - p;
    if (t == 1) {
      int x;
      cin >> x;
      a[p] = x;
      update(0, m - 1, 0, 1, p, m - 1);
    } else
      update(0, m - 1, 0, -1, p, m - 1);
    int x = query(0, m - 1, 0);
    if (x == (int)1e9)
      cout << "-1\n";
    else
      cout << a[x] << "\n";
  }
}
