#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long int N = 1e3 + 30;
vector<vector<long long int> > adj;
bool visited[N];
void dfs(long long int v) {
  visited[v] = 1;
  for (long long int u : adj[v]) {
    if (!visited[u]) {
      dfs(u);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie();
  long long int n, ind = -1;
  cin >> n;
  adj.resize(n + 50);
  pair<long long int, long long int> p[n + 50];
  while (n--) {
    long long int a, b;
    long long int t;
    cin >> t >> a >> b;
    if (t == 1) {
      ind++;
      p[ind].first = a;
      p[ind].second = b;
      for (long long int i = 0; i < ind; i++) {
        if ((p[ind].first > p[i].first && p[ind].first < p[i].second) ||
            (p[ind].second > p[i].first && p[ind].second < p[i].second)) {
          adj[ind].push_back(i);
        }
        if ((p[ind].first < p[i].first && p[i].first < p[ind].second) ||
            (p[ind].second > p[i].second && p[ind].first < p[i].second)) {
          adj[i].push_back(ind);
        }
      }
    } else {
      for (long long int i = 0; i < N; i++) visited[i] = 0;
      dfs(a - 1);
      if (visited[b - 1])
        cout << "YES" << '\n';
      else
        cout << "NO" << '\n';
    }
  }
  return 0;
}
