#include <bits/stdc++.h>
using namespace std;
const int MAX = 110;
int n, pos, pointer = 1, x, y, cnt, c[MAX];
bool v[MAX];
vector<int> a[MAX];
void DFS(int start) {
  int current;
  v[start] = true;
  c[start] = 1;
  for (int i = 0; i < a[start].size(); i++) {
    current = a[start][i];
    if (!v[current]) {
      DFS(current);
    }
  }
}
struct interval {
  int s, e;
  interval() {
    s = 0;
    e = 0;
  }
};
interval l[MAX];
bool connect(interval a, interval b) {
  if (b.s < a.s && a.s < b.e || b.s < a.e && a.e < b.e) {
    return true;
  }
  return false;
}
void go() {
  for (int j = 1; j < pointer; j++) {
    if (connect(l[pointer], l[j])) {
      a[pointer].push_back(j);
    }
    if (connect(l[j], l[pointer])) {
      a[j].push_back(pointer);
    }
  }
}
void free() {
  for (int i = 1; i <= pointer; i++) {
    v[i] = false;
    c[i] = 0;
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> pos;
    if (pos == 1) {
      cin >> l[pointer].s >> l[pointer].e;
      go();
      pointer++;
    } else {
      cin >> x >> y;
      free();
      DFS(x);
      if (c[x] == c[y]) {
        cout << "YES\n";
      } else {
        cout << "NO\n";
      }
    }
  }
  return 0;
}
