#include <bits/stdc++.h>
using namespace std;
const int N = 8e5 + 10;
struct Opt {
  int a;
  long long b, c;
} o[N];
long long pos[N];
int p;
int tg[N << 3], m0[N << 3], m1[N << 3], L[N << 3], R[N << 3];
void build(int x, int l, int r) {
  L[x] = l, R[x] = r;
  if (l == r) {
    m0[x] = l, m1[x] = (0x3f3f3f3f);
    return;
  }
  int mid = (l + r) >> 1;
  build(x << 1, l, mid), build(x << 1 | 1, mid + 1, r);
  m0[x] = min(m0[x << 1], m0[x << 1 | 1]),
  m1[x] = min(m1[x << 1], m1[x << 1 | 1]);
}
void se(int x, int con) {
  int l = L[x], r = R[x];
  if (con < 3) {
    tg[x] = con;
    if (con == 1)
      m1[x] = l, m0[x] = (0x3f3f3f3f);
    else
      m0[x] = l, m1[x] = (0x3f3f3f3f);
  } else if (tg[x] == 1)
    tg[x] = 2, m0[x] = l, m1[x] = (0x3f3f3f3f);
  else if (tg[x] == 2)
    tg[x] = 1, m1[x] = l, m0[x] = (0x3f3f3f3f);
  else if (tg[x] == 3)
    tg[x] = 0, swap(m0[x], m1[x]);
  else
    tg[x] = con, swap(m0[x], m1[x]);
}
void pud(int x) {
  if (!tg[x]) return;
  se(x << 1, tg[x]), se(x << 1 | 1, tg[x]), tg[x] = 0;
}
void updata(int x, int l, int r, int xl, int xr, int con) {
  pud(x);
  if (xl <= l && r <= xr) {
    se(x, con);
    return;
  }
  int mid = (l + r) >> 1;
  if (xl <= mid) updata(x << 1, l, mid, xl, xr, con);
  if (xr > mid) updata(x << 1 | 1, mid + 1, r, xl, xr, con);
  m0[x] = min(m0[x << 1], m0[x << 1 | 1]),
  m1[x] = min(m1[x << 1], m1[x << 1 | 1]);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, a;
  long long b, c;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c, o[i] = {a, b, c}, pos[p++] = b, pos[p++] = c;
    if (b != 1) pos[p++] = b - 1;
    pos[p++] = c + 1;
  }
  pos[p++] = 1;
  sort(pos, pos + p), p = unique(pos, pos + p) - pos;
  build(1, 1, p);
  for (int i = 0; i < n; i++) {
    a = o[i].a, b = o[i].b, c = o[i].c;
    b = lower_bound(pos, pos + p, b) - pos,
    c = lower_bound(pos, pos + p, c) - pos, b++, c++;
    updata(1, 1, p, b, c, a);
    if (m0[1] <= p)
      cout << pos[m0[1] - 1] << endl;
    else
      cout << pos[p - 1] + 1 << endl;
  }
  return 0;
}
