#include <bits/stdc++.h>
struct nd {
  int max;
  int l, r;
  nd() : max(0), l(0), r(0){};
};
const int MAXN = 100000;
int N, Q;
nd tree[MAXN << 3];
int lazy[MAXN << 3];
int X[MAXN];
inline int lc(int n) { return n << 1; }
inline int rc(int n) { return n << 1 | 1; }
nd merge(const nd &a, const nd &b) {
  nd out;
  out.max = std::max(a.max, b.max);
  out.l = a.l;
  out.r = b.r;
  return out;
}
void prop(int node) {
  if (!lazy[node]) return;
  tree[node].max += lazy[node];
  lazy[lc(node)] += lazy[node];
  lazy[rc(node)] += lazy[node];
  lazy[node] = 0;
}
void print() {
  for (int i = 1; i <= 10; ++i)
    std::cout << i << ' ' << tree[i].l << ' ' << tree[i].r << ": "
              << tree[i].max << std::endl;
}
void build(int l = 0, int r = N - 1, int node = 1) {
  if (l == r) {
    tree[node].l = tree[node].r = l;
    return;
  }
  int m = (l + r) / 2;
  build(l, m, lc(node));
  build(m + 1, r, rc(node));
  tree[node] = merge(tree[lc(node)], tree[rc(node)]);
}
void set(int ul, int ur, int v, int l = 0, int r = N - 1, int node = 1) {
  prop(node);
  if (l > r || l > ur || r < ul) return;
  if (ul <= l && r <= ur) {
    assert(!lazy[node]);
    lazy[node] += v;
    prop(node);
    return;
  }
  int m = (l + r) >> 1;
  set(ul, ur, v, l, m, lc(node));
  set(ul, ur, v, m + 1, r, rc(node));
  tree[node] = merge(tree[lc(node)], tree[rc(node)]);
}
int get(int l = 0, int r = N - 1, int node = 1) {
  prop(node);
  if (tree[node].max <= 0) return -1;
  if (l == r) return l;
  int m = (l + r) / 2;
  int v = get(m + 1, r, rc(node));
  return v == -1 ? get(l, m, lc(node)) : v;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin >> N;
  build();
  int P, T;
  for (int n = 0; n < N; ++n) {
    std::cin >> P >> T;
    --P;
    if (T == 1) {
      std::cin >> X[P];
      set(0, P, 1);
    } else {
      set(0, P, -1);
    }
    int v = get();
    if (v == -1)
      std::cout << -1 << std::endl;
    else
      std::cout << X[v] << std::endl;
  }
}
