#include <bits/stdc++.h>
using namespace std;
long long store[100000 + 5];
long long lazy[4 * 100000 + 5];
pair<long long, long long> tree[4 * 100000 + 5];
void update(long long low, long long high, long long l, long long h,
            long long idx, long long v) {
  if (lazy[idx] != 0) {
    tree[idx].first += lazy[idx];
    tree[idx].second += lazy[idx];
    if (low != high) {
      lazy[2 * idx] += lazy[idx];
      lazy[2 * idx + 1] += lazy[idx];
    }
    lazy[idx] = 0;
  }
  if (high < l || low > h) return;
  if (low >= l && high <= h) {
    tree[idx].first += v;
    tree[idx].second += v;
    if (low != high) {
      lazy[2 * idx] += v;
      lazy[2 * idx + 1] += v;
    }
    return;
  }
  long long mid = low + (high - low) / 2;
  update(low, mid, l, h, 2 * idx, v);
  update(mid + 1, high, l, h, 2 * idx + 1, v);
  tree[idx].first = max(tree[2 * idx].first, tree[2 * idx + 1].first);
  tree[idx].second = min(tree[2 * idx].second, tree[2 * idx + 1].second);
}
long long query(long long low, long long high, long long idx) {
  if (lazy[idx] != 0) {
    tree[idx].first += lazy[idx];
    tree[idx].second += lazy[idx];
    if (low != high) {
      lazy[2 * idx] += lazy[idx];
      lazy[2 * idx + 1] += lazy[idx];
    }
    lazy[idx] = 0;
  }
  if (low == high)
    return low;
  else {
    long long mid = low + (high - low) / 2;
    if (tree[2 * idx + 1].first + lazy[2 * idx + 1] >= 1 &&
        tree[2 * idx + 1].second + lazy[2 * idx + 1] <= 1)
      return query(mid + 1, high, 2 * idx + 1);
    else
      return query(low, mid, 2 * idx);
  }
}
int main() {
  long long m;
  scanf("%lld", &m);
  store[0] = -1;
  for (long long i = 1; i <= m; ++i) {
    long long p, t, x;
    scanf("%lld %lld", &p, &t);
    if (t == 1) {
      scanf("%lld", &x);
      store[p] = x;
      update(1, m, 1, p, 1, 1);
    } else
      update(1, m, 1, p, 1, -1);
    long long a;
    if (tree[1].first >= 1 && tree[1].second <= 1)
      a = query(1, m, 1);
    else
      a = 0;
    printf("%lld\n", store[a]);
  }
  return 0;
}
