#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
struct op {
  int t, id, type, x;
  op(int t, int id, int type, int x) : t(t), id(id), type(type), x(x){};
};
bool operator<(op a, op b) { return (a.t < b.t); }
bool cmp(op a, op b) { return (a.id > b.id); }
vector<op> o;
int n;
int ans[maxn];
int value[maxn];
int pre[maxn];
struct node {
  int sum, lazy, maior;
} seg[4 * maxn];
void build(int idx, int i, int j) {
  if (i == j) {
    seg[idx].sum = pre[i];
    seg[idx].maior = pre[i];
    return;
  }
  int mid = (i + j) >> 1;
  int left = idx << 1;
  int right = left | 1;
  build(left, i, mid);
  build(right, mid + 1, j);
  seg[idx].maior = max(seg[left].maior, seg[right].maior);
}
void refresh(int idx, int i, int j) {
  if (!seg[idx].lazy) return;
  int left = idx << 1;
  int right = left | 1;
  if (i != j) {
    seg[left].lazy += seg[idx].lazy;
    seg[right].lazy += seg[idx].lazy;
  } else
    seg[idx].sum += seg[idx].lazy;
  seg[idx].maior += seg[idx].lazy;
  seg[idx].lazy = 0;
}
void update(int idx, int i, int j, int ini, int fim, int val) {
  refresh(idx, i, j);
  if (i > j || j < ini || fim < i) return;
  if (ini <= i && j <= fim) {
    seg[idx].lazy += val;
    refresh(idx, i, j);
    return;
  }
  int mid = (i + j) >> 1;
  int left = idx << 1;
  int right = left | 1;
  update(left, i, mid, ini, fim, val);
  update(right, mid + 1, j, ini, fim, val);
  seg[idx].maior = max(seg[left].maior, seg[right].maior);
}
int get(int idx, int i, int j) {
  refresh(idx, i, j);
  if (seg[idx].maior <= 0) return -1;
  if (i == j) return value[i];
  int mid = (i + j) >> 1;
  int left = idx << 1;
  int right = left | 1;
  int ret = get(right, mid + 1, j);
  if (ret != -1) return ret;
  return get(left, i, mid);
}
void solve() {
  sort(o.begin(), o.end());
  for (int i = 0; i < o.size(); ++i) {
    int t = o[i].t;
    int type = o[i].type;
    int x = o[i].x;
    if (type) {
      value[t] = x;
      ++pre[t];
    } else
      --pre[t];
  }
  for (int i = n; i >= 1; i--) pre[i] += pre[i + 1];
  build(1, 1, n);
  sort(o.begin(), o.end(), cmp);
  for (int i = 0; i < o.size(); ++i) {
    int type = o[i].type;
    int id = o[i].id;
    int t = o[i].t;
    ans[id] = get(1, 1, n);
    if (type)
      update(1, 1, n, 1, t, -1);
    else
      update(1, 1, n, 1, t, +1);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int t, type, x = -1;
    scanf("%d %d", &t, &type);
    if (type) scanf("%d", &x);
    o.push_back(op(t, i, type, x));
  }
  solve();
  for (int i = 1; i <= n; ++i) printf("%d\n", ans[i]);
  return 0;
}
