#include <bits/stdc++.h>
using namespace std;
void dfs(int u, vector<vector<int> >& adj, vector<bool>& vist) {
  vist[u] = true;
  for (int i = 0; i < adj[u].size(); ++i) {
    int v = adj[u][i];
    if (not vist[v]) dfs(v, adj, vist);
  }
}
bool puc(int u, int v, vector<vector<int> >& adj) {
  vector<bool> vist(adj.size(), false);
  dfs(u, adj, vist);
  return vist[v];
}
int main() {
  vector<int> X, Y;
  vector<vector<int> > adj;
  int q;
  cin >> q;
  while (q--) {
    int t, a, b;
    cin >> t >> a >> b;
    if (t == 2)
      cout << (puc(a - 1, b - 1, adj) ? "YES" : "NO") << endl;
    else {
      int id = adj.size();
      adj.resize(id + 1);
      X.push_back(a);
      Y.push_back(b);
      for (int i = 0; i < id; ++i) {
        if ((a < X[i] and X[i] < b) or (a < Y[i] and Y[i] < b))
          adj[i].push_back(id);
        if ((X[i] < a and a < Y[i]) or (X[i] < b and b < Y[i]))
          adj[id].push_back(i);
      }
    }
  }
}
