#include <bits/stdc++.h>
using namespace std;
bool dfs(int v, int need, vector<bool>& used, const vector<vector<bool> >& g) {
  if (v == need) return true;
  if (used[v]) return false;
  used[v] = true;
  for (int i = 0; i < used.size(); i++)
    if (g[v][i] && dfs(i, need, used, g)) return true;
  return false;
}
int main() {
  int t;
  cin >> t;
  vector<vector<bool> > v(t, vector<bool>(t, false));
  vector<int> lefts;
  vector<int> rights;
  int intervals = 0;
  for (int q = 0; q < t; q++) {
    int type, a, b;
    cin >> type >> a >> b;
    if (type == 1) {
      lefts.push_back(a);
      rights.push_back(b);
      for (int i = 0; i < intervals; i++) {
        if ((lefts[i] < a && a < rights[i]) ||
            (lefts[i] < b && b < rights[i])) {
          v[intervals][i] = true;
        }
        if ((a < lefts[i] && lefts[i] < b) ||
            (a < rights[i] && rights[i] < b)) {
          v[i][intervals] = true;
        }
      }
      intervals++;
    } else {
      vector<bool> used(intervals);
      cout << (dfs(a - 1, b - 1, used, v) ? "YES" : "NO") << "\n";
    }
  }
}
