#include <bits/stdc++.h>
using namespace std;
const bool debug = true;
const int MAXN = 100010;
int dp[MAXN], t[MAXN];
const int inf = 2000000010;
int n;
int first_lower(int x) {
  if (x < 0) return 0;
  return upper_bound(t + 1, t + n + 1, x) - t - 1;
}
struct node {
  int mx;
  int lazy;
  node() {}
  node(int _mx, int _lazy) {
    mx = _mx;
    lazy = _lazy;
  }
  node operator+(const node &a) const { return *(new node(max(mx, a.mx), 0)); }
} st[4 * MAXN];
int value[MAXN];
void propagate(int idx, int left, int right) {
  if (st[idx].lazy == 0) return;
  st[idx].mx += st[idx].lazy;
  if (left != right) {
    st[2 * idx].lazy += st[idx].lazy;
    st[2 * idx + 1].lazy += st[idx].lazy;
  }
  st[idx].lazy = 0;
}
void update(int idx, int left, int right, int l, int r, int val) {
  if (l <= left && right <= r) {
    st[idx].lazy += val;
    return;
  }
  propagate(idx, left, right);
  if (r > (left + right) / 2)
    update(2 * idx + 1, (left + right) / 2 + 1, right, l, r, val);
  if (l <= (left + right) / 2)
    update(2 * idx, left, (left + right) / 2, l, r, val);
  propagate(2 * idx, left, (left + right) / 2);
  propagate(2 * idx + 1, (left + right) / 2 + 1, right);
  st[idx] = st[2 * idx] + st[2 * idx + 1];
}
int get(int idx, int left, int right) {
  propagate(idx, left, right);
  if (left != right) {
    propagate(2 * idx, left, (left + right) / 2);
    propagate(2 * idx + 1, (left + right) / 2 + 1, right);
  }
  if (left == right)
    if (st[idx].mx > 0)
      return value[left];
    else
      return -1;
  if (st[2 * idx + 1].mx > 0)
    return get(2 * idx + 1, (left + right) / 2 + 1, right);
  else if (st[2 * idx].mx > 0)
    return get(2 * idx, left, (left + right) / 2);
  else
    return -1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int p, type;
    scanf("%d %d", &p, &type);
    if (type == 1) {
      int val;
      scanf("%d", &val);
      value[p] = val;
      update(1, 1, n, 1, p, 1);
    } else
      update(1, 1, n, 1, p, -1);
    printf("%d\n", get(1, 1, n));
  }
  return 0;
}
