#include <bits/stdc++.h>
using namespace std;
struct segment {
  segment() : sum(0), left(0), right(0), best(0) {}
  int sum, left, right, best;
};
int m, s = 1;
vector<segment> st;
vector<int> x;
void update(int i, int val) {
  i += s - 1;
  st[i].right = max(0, val);
  st[i].sum += val;
  while (i > 0) {
    i = (i - 1) / 2;
    st[i].sum += val;
    st[i].right =
        max(st[2 * i + 2].right, st[2 * i + 2].sum + st[2 * i + 1].right);
  }
}
int sum(int a, int b) {
  a += s - 1;
  b += s - 1;
  int total = 0;
  while (a != b) {
    if (a % 2 == 1) {
      a /= 2;
    } else {
      total += st[a].sum;
      a /= 2;
    }
    if (b % 2 == 1) {
      total += st[b].sum;
      b = b / 2 - 1;
    } else {
      b = b / 2 - 1;
    }
  }
  return total + st[a].sum;
}
int bs(int a, int b) {
  int c = (a + b) / 2;
  return 0;
}
int main() {
  cin >> m;
  while (s < m) s *= 2;
  st = vector<segment>(4 * s);
  x.resize(m);
  for (int(i) = 0; (i) < (m); ++(i)) {
    int p, t;
    cin >> p >> t;
    --p;
    if (t == 1) cin >> x[p];
    t = t * 2 - 1;
    update(p, t);
    int j = 0, off = 0;
    while (j < s - 1) {
      if (st[2 * j + 2].right + off > 0) {
        j = 2 * j + 2;
      } else {
        off += st[2 * j + 2].sum;
        j = 2 * j + 1;
      }
    }
    off += st[j].right;
    if (off > 0) {
      cout << x[j - s + 1] << endl;
    } else {
      cout << -1 << endl;
    }
  }
  return 0;
}
