#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10;
const long long inf = 0x3f3f3f3f3f3f3f3f;
long long n;
struct node {
  long long f0, f1;
  long long lazy;
  node *l, *r;
  node(long long f0 = inf, long long f1 = inf) : f0(f0), f1(f1) {
    l = nullptr, r = nullptr;
    lazy = 0;
  }
};
node *root;
void upd_lazy(node *no, long long l) {
  if (l == 3) {
    if (no->lazy == 0)
      no->lazy = l;
    else if (no->lazy == 1)
      no->lazy = 2;
    else if (no->lazy == 2)
      no->lazy = 1;
    else
      no->lazy = 0;
  } else
    no->lazy = l;
}
void flush(node *no, long long ini, long long fim) {
  if (no == nullptr || no->lazy == 0) return;
  if (no->lazy == 1)
    no->f0 = inf, no->f1 = ini;
  else if (no->lazy == 2)
    no->f0 = ini, no->f1 = inf;
  else {
    swap(no->f0, no->f1);
  }
  if (ini != fim) {
    long long meio = (ini + fim) / 2;
    if (no->l == nullptr) no->l = new node(ini, inf);
    if (no->r == nullptr) no->r = new node(meio + 1, inf);
    upd_lazy(no->l, no->lazy);
    upd_lazy(no->r, no->lazy);
  }
  no->lazy = 0;
}
void update(node *no, long long l, long long r, long long x, long long ini = 1,
            long long fim = (long long)1e6) {
  flush(no, ini, fim);
  if (l <= ini && fim <= r) {
    upd_lazy(no, x);
    flush(no, ini, fim);
    return;
  }
  long long meio = (ini + fim) / 2;
  if (r <= meio) {
    if (no->l == nullptr) no->l = new node(ini, inf);
    update(no->l, l, r, x, ini, meio);
  } else if (l > meio) {
    if (no->r == nullptr) no->r = new node(meio + 1, inf);
    update(no->r, l, r, x, meio + 1, fim);
  } else {
    if (no->l == nullptr) no->l = new node(ini, inf);
    if (no->r == nullptr) no->r = new node(meio + 1, inf);
    update(no->l, l, r, x, ini, meio);
    update(no->r, l, r, x, meio + 1, fim);
  }
  if (no->r != nullptr) flush(no->r, meio + 1, fim);
  if (no->l != nullptr) flush(no->l, ini, meio);
  no->f0 = min(no->l ? no->l->f0 : ini, no->r ? no->r->f0 : meio + 1);
  no->f1 = min(no->l ? no->l->f1 : inf, no->r ? no->r->f1 : inf);
}
long long cot[1000010];
int32_t main() {
  cin >> n;
  root = new node(1, inf);
  vector<pair<long long, pair<long long, long long> > > vet;
  vector<long long> comp;
  comp.push_back(1);
  for (long long i = 1; i <= n; i++) {
    long long l, r;
    long long x;
    cin >> x >> l >> r;
    vet.push_back({x, {l, r}});
    comp.push_back(l);
    comp.push_back(l + 1);
    comp.push_back(r);
    comp.push_back(r + 1);
  }
  sort(comp.begin(), comp.end());
  comp.erase(unique(comp.begin(), comp.end()), comp.end());
  for (auto &e : comp) {
    cot[lower_bound(comp.begin(), comp.end(), e) - comp.begin() + 1] = e;
  }
  for (auto &e : vet) {
    e.second.first = lower_bound(comp.begin(), comp.end(), e.second.first) -
                     comp.begin() + 1;
    e.second.second = lower_bound(comp.begin(), comp.end(), e.second.second) -
                      comp.begin() + 1;
  }
  for (auto &e : vet) {
    long long x = e.first;
    long long l, r;
    l = e.second.first;
    r = e.second.second;
    cin >> x >> l >> r;
    update(root, l, r, x);
    cout << cot[root->f0] << "\n";
  }
  return 0;
}
