#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 100;
int n;
int v[MAXN];
pair<int, int> seg[4 * MAXN];
void update(int pos, int ini, int fim, int id, int val);
int bb(int pos, int ini, int fim, int val);
int main() {
  scanf("%d", &n);
  update(1, 0, n, 0, MAXN);
  for (int i = 1; i <= n; i++) {
    int id, type;
    scanf("%d %d", &id, &type);
    if (type) {
      scanf("%d", &v[id]);
      update(1, 0, n, id, 1);
    } else
      update(1, 0, n, id, -1);
    int ans = v[bb(1, 0, n, 0)];
    if (ans == 0) ans = -1;
    printf("%d\n", ans);
  }
}
void update(int pos, int ini, int fim, int id, int val) {
  if (ini > id || fim < id) return;
  if (ini == fim) {
    if (val > 0)
      seg[pos].first += val;
    else
      seg[pos].second += -val;
    return;
  }
  int mid = (ini + fim) >> 1, e = pos << 1, d = e | 1;
  update(e, ini, mid, id, val);
  update(d, mid + 1, fim, id, val);
  seg[pos].first =
      seg[e].first + seg[d].first - min(seg[e].first, seg[d].second);
  seg[pos].second =
      seg[e].second + seg[d].second - min(seg[e].first, seg[d].second);
  return;
}
int bb(int pos, int ini, int fim, int val) {
  if (ini == fim) return ini;
  int mid = (ini + fim) >> 1, e = pos << 1, d = e | 1;
  if (seg[d].first > val)
    return bb(d, mid + 1, fim, val);
  else
    return bb(e, ini, mid, val + seg[d].second - seg[d].first);
}
