#include <bits/stdc++.h>
using namespace std;
const int sz = 2e+5;
long long int arr[sz] = {0}, arr1[sz] = {0}, arr2[sz] = {0}, id[sz];
char arrc6[205][205];
int arrtd[205][205] = {0};
bool visited[1000], visited1[50000];
int prime[10005] = {0};
vector<long long int> vec, vec1, vec2, vecc[sz];
vector<pair<int, int>> vecp, vecp1;
set<long long int> st;
vector<long long int> edges[50000], cost[50000];
long long int len[50000];
map<string, int> mp;
int dir1[6] = {0, 1, 0, 0, 0, 1};
int dir2[6] = {0, 0, 1, 0, -1, 0};
void dfs(int n) {
  visited[n] = true;
  for (auto nxt : edges[n]) {
    if (!visited[nxt]) dfs(nxt);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t;
  cin >> t;
  int cnt1 = 0;
  for (int i = 0; i < t; i++) {
    int n, a, b;
    cin >> n >> a >> b;
    if (n == 1) {
      cnt1++;
      vecp.push_back({a, b});
    } else {
      memset(visited, false, sizeof(visited));
      dfs(a);
      if (visited[b])
        cout << "YES\n";
      else
        cout << "NO\n";
      continue;
    }
    int cnt = 0;
    for (auto it = vecp.begin(); it != vecp.end(); it++) {
      cnt++;
      if ((a > it->first && a < it->second) ||
          (b > it->first && b < it->second)) {
        edges[cnt1].push_back(cnt);
      }
      if (it->first > a && it->first < b || it->second > a && it->second < b) {
        edges[cnt].push_back(cnt1);
      }
    }
  }
}
