#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:64000000")
const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 2100000000;
const double EPS = 1e-9;
const long double PI = acos(-1.0);
vector<vector<int> > a;
vector<pair<int, int> > bounds;
vector<bool> was;
void dfs(int v) {
  was[v] = true;
  for (int i = 0; i < a[v].size(); ++i) {
    if (!was[a[v][i]]) dfs(a[v][i]);
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int type, u, v;
    cin >> type >> u >> v;
    if (type == 1) {
      a.push_back(vector<int>());
      for (int i = 0; i < bounds.size(); ++i) {
        int c = bounds[i].first;
        int d = bounds[i].second;
        if (u < c && c < v || u < d && d < v) a[i].push_back(bounds.size());
        if (c < u && u < d || c < v && v < d) a[bounds.size()].push_back(i);
      }
      bounds.push_back(make_pair(u, v));
    } else {
      --u, --v;
      was.assign(bounds.size(), false);
      dfs(u);
      if (was[v])
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
