#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>> T;
bool dfs(map<pair<int, int>, set<pair<int, int>>>& M, pair<int, int> src,
         pair<int, int> dst) {
  if (src == dst) return true;
  T.insert(src);
  bool f = false;
  for (auto it : M[src]) {
    if (T.find(it) == T.end()) {
      f |= dfs(M, it, dst);
    }
  }
  return f;
}
void addedge(map<pair<int, int>, set<pair<int, int>>>& M, pair<int, int> X) {
  for (auto it : M) {
    if ((it.first.first < X.first && it.first.second > X.first) ||
        (it.first.first < X.second && it.first.second > X.second)) {
      M[X].insert(it.first);
    }
    if ((it.first.first > X.first && it.first.first < X.second) ||
        (it.first.second < X.second && it.first.second > X.first)) {
      M[it.first].insert(X);
    }
  }
}
int main() {
  int n, a, b, type;
  cin >> n;
  map<pair<int, int>, set<pair<int, int>>> M;
  vector<pair<int, int>> V;
  while (n--) {
    cin >> type >> a >> b;
    if (type == 1) {
      M[{a, b}] = {};
      addedge(M, {a, b});
      V.push_back({a, b});
    } else {
      T.clear();
      if (dfs(M, V[a - 1], V[b - 1]))
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
  return 0;
}
