#include <bits/stdc++.h>
using namespace std;
int p;
void dfs(int a, int b, map<pair<long long int, long long int>, int> m,
         vector<pair<long long int, long long int> > vp[], int visit[],
         vector<pair<long long int, long long int> > v) {
  if (a == b) {
    p = 1;
    return;
  }
  if (visit[a] == 0) {
    visit[a] = 1;
    ;
    for (long int i = 0; i < vp[a].size(); i++) {
      dfs(m[make_pair(vp[a][i].first, vp[a][i].second)], b, m, vp, visit, v);
    }
  }
  return;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  std::vector<pair<long long int, long long int> > v;
  std::vector<pair<long long int, long long int> > vp[n];
  map<pair<long long int, long long int>, int> m;
  int z = 0;
  ;
  for (long int k = 0; k < n; k++) {
    int c;
    cin >> c;
    if (c == 1) {
      long long int x, y;
      cin >> x >> y;
      v.push_back(make_pair(x, y));
      m[make_pair(x, y)] = (z++);
      ;
      for (long int j = 0; j < v.size() - 1; j++) {
        if ((v[j].first < x && x < v[j].second) ||
            (v[j].first < y && y < v[j].second)) {
          vp[z - 1].push_back(make_pair(v[j].first, v[j].second));
        }
        if ((v[j].first > x && y > v[j].first) ||
            (v[j].second < y && x < v[j].second)) {
          vp[j].push_back(make_pair(x, y));
        }
      }
    }
    if (c == 2) {
      long long int a, b;
      p = 0;
      cin >> a >> b;
      a--;
      b--;
      int visit[v.size()];
      memset(visit, 0, sizeof(visit));
      dfs(a, b, m, vp, visit, v);
      if (p == 1)
        cout << "YES" << '\n';
      else
        cout << "NO" << '\n';
    }
  }
  return 0;
}
