#include <bits/stdc++.h>
using namespace std;
template <class T, class S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  return os << "(" << v.first << ", " << v.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (int i = int(0); i <= int((static_cast<int>((v).size())) - 1); ++i) {
    if (i) os << ", ";
    os << v[i];
  }
  return os << "]";
}
template <class T>
bool setmax(T& _a, T _b) {
  if (_a < _b) {
    _a = _b;
    return true;
  }
  return false;
}
template <class T>
bool setmin(T& _a, T _b) {
  if (_b < _a) {
    _a = _b;
    return true;
  }
  return false;
}
template <class T>
T gcd(T _a, T _b) {
  return _b == 0 ? _a : gcd(_b, _a % _b);
}
const int N = 100000;
struct Node {
  int x, y;
} tr[N * 4];
int val[N];
int n;
void go(int x, int l, int r, int ind, int v) {
  if (l + 1 == r) {
    if (v < 0) {
      tr[x].x = 1;
    } else {
      tr[x].y = 1;
    }
    return;
  }
  const int m = (l + r) / 2;
  if (ind < m) {
    go(x * 2 + 1, l, m, ind, v);
  } else {
    go(x * 2 + 2, m, r, ind, v);
  }
  int d = min(tr[x * 2 + 1].y, tr[x * 2 + 2].x);
  tr[x].x = tr[x * 2 + 1].x + tr[x * 2 + 2].x - d;
  tr[x].y = tr[x * 2 + 1].y + tr[x * 2 + 2].y - d;
}
int get(int x, int l, int r, int rank) {
  if (l + 1 == r) {
    assert(tr[x].x == 0 && tr[x].y == 1);
    return l;
  }
  const int m = (l + r) / 2;
  int ly = tr[x * 2 + 1].y;
  int rx = tr[x * 2 + 2].x, ry = tr[x * 2 + 2].y;
  int d = min(ly, rx);
  if (rank < ry) {
    return get(x * 2 + 2, m, r, rank);
  } else {
    return get(x * 2 + 1, l, m, rank - ry + d);
  }
}
int main() {
  scanf("%d", &n);
  memset(tr, 0, sizeof(tr));
  for (int i = int(0); i <= int((n)-1); ++i) {
    int ind, t;
    scanf("%d%d", &ind, &t);
    --ind;
    if (t == 0) {
      go(0, 0, n, ind, -1);
    } else {
      go(0, 0, n, ind, 1);
      scanf("%d", &val[ind]);
    }
    if (tr[0].y == 0) {
      printf("-1\n");
    } else {
      int ans = get(0, 0, n, 0);
      printf("%d\n", val[ans]);
    }
  }
  return 0;
}
