#include <bits/stdc++.h>
using namespace std;
long long int currIndex = 1;
void dfs(long long int x, vector<bool>* visited, vector<long long int> start,
         vector<long long int> end) {
  (*visited)[x] = true;
  for (long long int i = 1; i < currIndex; i++) {
    if (!(*visited)[i] && ((start[i] < start[x] && start[x] < end[i]) ||
                           (start[i] < end[x] && end[x] < end[i])))
      dfs(i, visited, start, end);
  }
}
int32_t main() {
  long long int n;
  cin >> n;
  vector<long long int> start(n), end(n);
  for (long long int i = 1; i <= n; i++) {
    long long int a, b, c;
    cin >> a >> b >> c;
    if (a == 1) {
      start[currIndex] = b;
      end[currIndex] = c;
      currIndex++;
    } else {
      vector<bool> visited(currIndex, false);
      visited[b] = true;
      dfs(b, &visited, start, end);
      if (visited[c] == true)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
}
