#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& _a4, C _b4) {
  _a4 = min(_a4, _b4);
}
template <class C>
void maxi(C& _a4, C _b4) {
  _a4 = max(_a4, _b4);
}
struct Tree {
  int d;
  int k;
  vector<int> maks;
  vector<int> wklad;
  void settle(int x) {
    if (x & d) {
      maks[x] = wklad[x];
    } else {
      int l = 2 * x;
      int r = 2 * x + 1;
      maks[x] = min(maks[l], maks[r]) + wklad[x];
    }
  }
  void zepchnij(int x) {
    int l = x << 1;
    int r = l ^ 1;
    wklad[l] += wklad[x];
    wklad[r] += wklad[x];
    wklad[x] = 0;
    settle(l);
    settle(r);
    settle(x);
  }
  void spychaj(int x) {
    x += d;
    for (int i = k; i > 0; --i) zepchnij(x >> i);
  }
  int query(int x) {
    int c = 1;
    while ((c & d) == 0) {
      int l = 2 * c;
      int r = 2 * c + 1;
      zepchnij(c);
      if (maks[r] < x)
        c = r;
      else
        c = l;
    }
    return c - d;
  }
  void update(int a, int b, long long x) {
    a += d;
    b += d;
    wklad[a] += x;
    if (a != b) {
      wklad[b] += x;
    }
    while (a) {
      if (a / 2 != b / 2) {
        if ((a & 1) == 0) {
          wklad[a + 1] += x;
          settle(a + 1);
        }
        if ((b & 1) == 1) {
          wklad[b - 1] += x;
          settle(b - 1);
        }
      }
      settle(a);
      settle(b);
      a /= 2;
      b /= 2;
    }
  }
  int makesize(int x) {
    x += 5;
    d = 1;
    k = 0;
    while (d < x) {
      d <<= 1;
      ++k;
    }
    maks.assign(2 * d + 1, 0);
    wklad.assign(2 * d + 1, 0);
    return d - 1;
  }
};
Tree T;
int m;
int val[120000];
int main() {
  scanf("%d", &m);
  int bd;
  bd = T.makesize(m + 10);
  T.update(0, 0, -1e7);
  int suma = 0;
  for (int i = (0); i <= ((int)(m)-1); i++) {
    int p, t;
    scanf("%d%d", &p, &t);
    --p;
    if (t == 1) {
      int x;
      scanf("%d", &x);
      val[p] = x;
      T.update(p + 2, bd, 1);
      ++suma;
    } else {
      T.update(p + 2, bd, -1);
      --suma;
    }
    p = T.query(suma);
    if (p == 0)
      puts("-1");
    else
      printf("%d\n", val[p - 1]);
  }
}
