#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T BM(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T mdINV(T a, T M) {
  return BM(a, M - 2, M);
}
template <class T>
inline T PW(T p, T e) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
template <class T>
string NTS(T Number) {
  stringstream ss;
  ss << Number;
  return ss.str();
}
template <class T>
T stringtonumber(const string &Text) {
  istringstream ss(Text);
  T result;
  return ss >> result ? result : 0;
}
template <class T>
bool ISLEFT(T a, T b, T c) {
  if (((a.first.first - b.first.first) * (b.second.second - c.second.second) -
       (b.first.first - c.first.first) * (a.second.second - b.second.second)) <
      0.0)
    return 1;
  else
    return 0;
}
pair<int, int> tr[100002ll * 4];
void update(int no, int s, int e, int in, int val) {
  if (s == e) {
    if (val == -1)
      tr[no] = make_pair(1, 0);
    else
      tr[no] = make_pair(0, 1);
    return;
  }
  int mid = (s + e) / 2;
  if (mid >= in)
    update(no * 2, s, mid, in, val);
  else
    update(no * 2 + 1, mid + 1, e, in, val);
  int mi = min(tr[no * 2].second, tr[no * 2 + 1].first);
  tr[no].first = tr[no * 2].first + tr[no * 2 + 1].first - mi;
  tr[no].second = tr[no * 2].second + tr[no * 2 + 1].second - mi;
}
int qu(int no, int s, int e, int va) {
  if (s == e) return s;
  int mid = (s + e) / 2;
  if (tr[no * 2 + 1].second > va)
    return qu(no * 2 + 1, mid + 1, e, va);
  else
    return qu(no * 2, s, mid,
              tr[no * 2 + 1].first + va - tr[no * 2 + 1].second);
}
int main() {
  int n;
  scanf("%d", &n);
  int ar[n + 2];
  memset(ar, -1, sizeof ar);
  for (int i = 1; i <= n; i++) {
    int in;
    scanf("%d", &in);
    int t;
    scanf("%d", &t);
    if (t == 0)
      update(1, 1, n, in, -1);
    else {
      int first;
      scanf("%d", &first);
      ar[in] = first;
      update(1, 1, n, in, 1);
    }
    int in1 = 0;
    if (tr[1].second > 0) {
      in1 = qu(1, 1, n, 0);
    }
    printf("%d", ar[in1]), printf("\n");
  }
  return 0;
}
