#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
int x[MAX], seg[4 * MAX], lazy[4 * MAX];
int fen[MAX];
void add_fen(int p, int val) {
  for (p++; p < MAX; p += p & -p) fen[p] += val;
}
int get(int p) {
  int ans = 0;
  for (; p > 0; p -= p & -p) ans += fen[p];
  return ans;
}
void shift(int v) {
  seg[2 * v] += lazy[v];
  seg[2 * v + 1] += lazy[v];
  lazy[2 * v] += lazy[v];
  lazy[2 * v + 1] += lazy[v];
  lazy[v] = 0;
}
void add(int l, int r, int val, int v, int s, int e) {
  if (l <= s && e <= r) {
    seg[v] += val;
    lazy[v] += val;
    return;
  }
  if (e <= l || r <= s) return;
  shift(v);
  int mid = (s + e) / 2;
  add(l, r, val, 2 * v, s, mid);
  add(l, r, val, 2 * v + 1, mid, e);
  seg[v] = min(seg[2 * v], seg[2 * v + 1]);
}
int get_min(int l, int r, int v, int s, int e) {
  if (l <= s && e <= r) return seg[v];
  if (e <= l || r <= s) return 2e9;
  shift(v);
  int mid = (s + e) / 2;
  return min(get_min(l, r, 2 * v, s, mid), get_min(l, r, 2 * v + 1, mid, e));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int _ = 0; _ < n; _++) {
    int p, t;
    cin >> p >> t;
    p--;
    if (t == 0) {
      int l = p, r = n + 1;
      while (r - l > 1) {
        int mid = (l + r) / 2;
        if (get_min(p, mid, 1, 0, n) > 0)
          l = mid;
        else
          r = mid;
      }
      if (l != p) add(p, l, -1, 1, 0, n);
      if (l != n) add_fen(l, 1);
    } else {
      int val;
      cin >> val;
      x[p] = val;
      int l = p, r = n + 1;
      int x = get(p);
      while (r - l > 1) {
        int mid = (l + r) / 2;
        if (get(mid) - x > 0)
          r = mid;
        else
          l = mid;
      }
      if (l != p) add(p, l, 1, 1, 0, n);
      if (l != n) add_fen(l, -1);
    }
    int sz = get_min(n - 1, n, 1, 0, n);
    if (!sz)
      cout << "-1\n";
    else {
      int l = -1, r = n;
      while (r - l > 1) {
        int mid = (l + r) / 2;
        if (get_min(mid, n, 1, 0, n) < sz)
          l = mid;
        else
          r = mid;
      }
      cout << x[r] << "\n";
    }
  }
  return 0;
}
