#include <bits/stdc++.h>
using namespace std;
long long max(long long n, long long m) {
  if (n >= m)
    return n;
  else
    return m;
}
long long min(long long n, long long m) {
  if (n <= m)
    return n;
  else
    return m;
}
void digest(vector<long long> &v, long long n) {
  long long elem;
  for (long long i = 0; i < n; i++) {
    cin >> elem;
    v.emplace_back(elem);
  }
}
void vomit(vector<long long> &v, long long a, long long n) {
  for (long long i = a; i < n; i++) cout << v.at(i) << " ";
  cout << "\n";
}
bool flag = false;
void dfs(long long node, vector<long long> v[], vector<long long> &visited,
         long long elem) {
  visited.at(node) = 1;
  if (node == elem) {
    flag = true;
    return;
  }
  for (long long i = 0; i < v[node].size(); i++) {
    if (visited.at(v[node].at(i)) == -1) dfs(v[node].at(i), v, visited, elem);
  }
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> v[n + 5];
  vector<pair<long long, long long>> p;
  p.emplace_back(-1, -1);
  vector<long long> visited(n + 5, -1);
  long long x, a, b;
  for (long long i = 1; i < n + 1; i++) {
    cin >> x;
    if (x == 1) {
      cin >> a >> b;
      for (long long j = 1; j < p.size(); j++) {
        if ((p.at(j).first < a and a < p.at(j).second) or
            (p.at(j).first < b and b < p.at(j).second))
          v[p.size()].emplace_back(j);
        if ((a < p.at(j).first and p.at(j).first < b) or
            (a < p.at(j).second and p.at(j).second < b))
          v[j].emplace_back(p.size());
      }
      p.emplace_back(a, b);
    } else {
      cin >> a >> b;
      fill((visited).begin(), (visited).end(), -1);
      dfs(a, v, visited, b);
      if (flag)
        cout << "YES\n";
      else
        cout << "NO\n";
      flag = false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
