#include <bits/stdc++.h>
using namespace std;
bool bfs(vector<vector<int> > &adj, int u, int v) {
  queue<int> Q;
  int n = adj.size();
  vector<int> visited(n);
  Q.push(u);
  visited[u] = 1;
  while (!Q.empty()) {
    int i = Q.front();
    Q.pop();
    if (i == v) return true;
    for (int j = 0; j < adj[i].size(); j++) {
      if (!visited[adj[i][j]]) {
        visited[adj[i][j]] = 1;
        Q.push(adj[i][j]);
      }
    }
  }
  return false;
}
int main() {
  map<int, pair<long long, long long> > m;
  vector<vector<int> > adj;
  int q;
  cin >> q;
  while (q--) {
    int t, a, b;
    cin >> t >> a >> b;
    if (t == 1) {
      vector<int> v;
      int k = adj.size();
      m[k] = {a, b};
      for (int i = 0; i < adj.size(); i++) {
        pair<long long, long long> p = m[i];
        if ((p.first < a and a < p.second) or (p.first < b and b < p.second)) {
          v.push_back(i);
        }
        if ((a < p.first and p.first < b) or (a < p.second and p.second < b)) {
          adj[i].push_back(k);
        }
      }
      adj.push_back(v);
    } else if (t == 2) {
      if (bfs(adj, a - 1, b - 1))
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  for (auto i : m) {
  }
  return 0;
}
