#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int MOD = 1000000007;
map<long long, bool> seq;
void upd(int t, long long l, long long r) {
  auto it = seq.lower_bound(l);
  int prev = -1;
  if (it != seq.begin() && (it == seq.end() || it->first != l)) {
    it--;
    prev = it->second;
    it++;
  }
  int last = -1;
  while (it != seq.end() && it->first <= r) {
    last = it->second;
    if (t == 3) {
      it->second = !it->second;
      it++;
    } else {
      it = seq.erase(it);
    }
  }
  if (t == 1) {
    seq[l] = 1;
  } else if (t == 2) {
    seq[l] = 0;
  }
  if (prev != -1) {
    if (t == 3) seq[l] = !prev;
    if (last == -1) last = prev;
  }
  if (last == -1) last = 0;
  if (it == seq.end() || it->first > r + 1) {
    seq[r + 1] = last;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  seq[1] = 0;
  while (n--) {
    long long t, l, r;
    cin >> t >> l >> r;
    upd(t, l, r);
    auto it = seq.begin();
    while (it != seq.end() && it->second == 1) it++;
    cout << it->first << endl;
  }
}
