#include <bits/stdc++.h>
using namespace std;
const int MXN = 100010;
const int MXX = 400050;
struct Segment_Tree {
  int x, add;
} tt[MXX];
int m, v[MXN], ans[MXN];
void Build(int l, int r, int idx) {
  tt[idx].x = 0;
  tt[idx].add = 0;
  if (l == r) {
    return;
  }
  int mid = (l + r) >> 1;
  Build(l, mid, idx << 1);
  Build(mid + 1, r, idx << 1 | 1);
}
inline void PushDown(int l, int r, int idx) {
  tt[idx << 1].add += tt[idx].add;
  tt[idx << 1].x += tt[idx].add;
  tt[idx << 1 | 1].add += tt[idx].add;
  tt[idx << 1 | 1].x += tt[idx].add;
  tt[idx].add = 0;
}
inline void PushUp(int l, int r, int idx) {
  tt[idx].x = max(tt[idx << 1].x, tt[idx << 1 | 1].x);
}
void Change(int L, int R, int x, int l, int r, int idx) {
  if (L <= l && r <= R) {
    tt[idx].add += x;
    tt[idx].x += x;
    return;
  }
  PushDown(l, r, idx);
  int mid = (l + r) >> 1;
  if (L <= mid) Change(L, R, x, l, mid, idx << 1);
  if (mid + 1 <= R) Change(L, R, x, mid + 1, r, idx << 1 | 1);
  PushUp(l, r, idx);
}
int Query(int L, int R, int l, int r, int idx) {
  if (L <= l && r <= R) {
    return tt[idx].x;
  }
  PushDown(l, r, idx);
  int mid = (l + r) >> 1, ans = -0x3f3f3f3f;
  if (L <= mid) ans = max(ans, Query(L, R, l, mid, idx << 1));
  if (mid + 1 <= R) ans = max(ans, Query(L, R, mid + 1, r, idx << 1 | 1));
  PushUp(l, r, idx);
  return ans;
}
int w;
inline bool Check(int x) {
  int tmp = Query(x, m, 1, m, 1);
  if (tmp > 0) {
    w = x;
    return 1;
  }
  return 0;
}
inline void Mybin(int low, int high) {
  w = 0;
  for (int mid = (low + high) >> 1; low <= high;
       (Check(mid) ? low = mid + 1 : high = mid - 1), mid = (low + high) >> 1)
    ;
}
inline void solve() {
  int p, t, x;
  scanf("%d", &m);
  Build(1, m, 1);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &t, &p);
    if (p == 0) {
      Change(1, t, -1, 1, m, 1);
    } else {
      scanf("%d", &x);
      v[t] = x;
      Change(1, t, 1, 1, m, 1);
    }
    Mybin(1, m);
    if (w == 0)
      ans[i] = -1;
    else
      ans[i] = v[w];
  }
  for (int i = 1; i <= m; i++) printf("%d\n", ans[i]);
}
int main() {
  solve();
  return 0;
}
