#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MAX = (int)1e5 + 100;
int inf = (int)1e9;
int mod = (int)1e9 + 7;
int n, k, a[MAX], m;
struct node {
  int l, r, maxi, mid, ad;
  node* son_l;
  node* son_r;
  node(int a, int b) {
    l = a;
    r = b;
    mid = (a + b) / 2;
    son_l = 0;
    ad = 0;
    son_r = 0;
    maxi = 0;
  }
};
void build(node* root) {
  if (root->l == root->r) return;
  root->son_l = new node(root->l, root->mid);
  root->son_r = new node(root->mid + 1, root->r);
  build(root->son_l);
  build(root->son_r);
}
void push(node* root) {
  root->son_l->ad += root->ad;
  root->son_r->ad += root->ad;
  root->ad = 0;
}
void upd(node* root) {
  root->maxi = max(root->son_l->maxi + root->son_l->ad,
                   root->son_r->maxi + root->son_r->ad);
}
int get_r(node* root) {
  if (root->l == root->r) return a[root->l];
  push(root);
  upd(root);
  if (root->son_r->maxi + root->son_r->ad > 0)
    return get_r(root->son_r);
  else
    return get_r(root->son_l);
}
void pl(node* root, int bl, int br, int val) {
  if (bl > br) return;
  if (root->l == bl && root->r == br)
    root->ad += val;
  else {
    push(root);
    pl(root->son_l, bl, min(root->mid, br), val);
    pl(root->son_r, max(root->mid + 1, bl), br, val);
    upd(root);
  }
}
void solve() {
  cin >> m;
  node* root = new node(1, m);
  build(root);
  for (int i = 1; i <= m; i++) {
    int p, t, x;
    cin >> p >> t;
    if (t) cin >> x;
    if (!t) {
      pl(root, 1, p, -1);
    } else {
      a[p] = x;
      pl(root, 1, p, 1);
    }
    if (root->maxi + root->ad < 1)
      cout << -1 << "\n";
    else {
      cout << get_r(root) << "\n";
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  int q;
  q = 1;
  while (q--) solve();
  return 0;
}
