#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using vll = vector<LL>;
using LD = long double;
template <typename T>
void check(T& a, const T& b) {
  if (a >= b) {
    a %= b;
  }
}
template <typename T>
T gcd(T u, T v) {
  if (u == v) return u;
  if (u == 0) return v;
  if (v == 0) return u;
  if (~u & 1) {
    if (v & 1)
      return gcd(u >> 1, v);
    else
      return gcd(u >> 1, v >> 1) << 1;
  }
  if (~v & 1) return gcd(u, v >> 1);
  if (u > v) return gcd((u - v) >> 1, v);
  return gcd((v - u) >> 1, u);
}
LL mulmod(LL a, LL b, const LL& m) {
  LL q = (LL)(((LD)a * (LD)b) / (LD)m);
  LL r = a * b - q * m;
  if (r > m) r %= m;
  if (r < 0) r += m;
  return r;
}
template <typename T, typename S>
T expo(T e, S n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T powerL(T e, T n, const T& m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mulmod(x, p, m);
    p = mulmod(p, p, m);
    n >>= 1;
  }
  return x;
}
const int N = (int)2e5 + 10;
class SegmentTree {
 public:
  vector<int> lazy, node;
  int n;
  SegmentTree() {}
  SegmentTree(int n) : n(n) {
    lazy.assign(n << 2, 0);
    node.assign(n << 2, 0);
  }
  void propogate(int i, int l, int r) {
    if (l == r) {
      lazy[i] = 0;
      return;
    }
    if (lazy[i]) {
      for (int j : {i << 1, i << 1 | 1}) {
        lazy[j] += lazy[i];
        node[j] += lazy[i];
      }
      lazy[i] = 0;
    }
  }
  void update(int k, int l, int r, int u, int v, int w) {
    propogate(k, l, r);
    if (l > r || l > v || r < u) return;
    if (l >= u && r <= v) {
      node[k] += w;
      lazy[k] += w;
      propogate(k, l, r);
      return;
    }
    int mid = (l + r) >> 1;
    update(k << 1, l, mid, u, v, w);
    update(k << 1 | 1, mid + 1, r, u, v, w);
    node[k] = max(node[k << 1], node[k << 1 | 1]);
  }
  void update(int u, int v, int w) { update(1, 1, n, u, v, w); }
  int query(int k, int l, int r) {
    propogate(k, l, r);
    if (node[k] <= 0) return 0;
    if (l == r) return l;
    int mid = (l + r) >> 1;
    if (node[k << 1 | 1] > 0) return query(k << 1 | 1, mid + 1, r);
    if (node[k << 1] > 0) return query(k << 1, l, mid);
  }
  int query(int l, int r) { return query(1, l, r); }
};
int x[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cerr.tie(NULL);
  ;
  double c1 = clock();
  int n;
  cin >> n;
  SegmentTree T(n);
  x[0] = -1;
  for (int i = 0; i < n; i++) {
    int a, t, val;
    cin >> a >> t;
    if (t) cin >> x[a];
    T.update(1, a, t ? 1 : -1);
    cout << x[T.query(1, n)] << '\n';
  }
  cerr << fixed << setprecision(10) << (clock() - c1) / CLOCKS_PER_SEC << '\n';
  return 0;
}
