#include <bits/stdc++.h>
using namespace std;
int caseno = 1;
typedef long long LL;
typedef unsigned long long ULL;
template <class T>
inline void SWAP(T &a, T &b) {
  T t = a;
  a = b;
  b = t;
}
inline LL POW(LL base, LL power) {
  LL res = base;
  if (power == 0) return 1;
  for (int I = 0; I < power - 1; I++) res *= base;
  return res;
}
int ToInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double ToDouble(string s) {
  double r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
string ToString(int n) {
  string s;
  stringstream convert;
  convert << n;
  s = convert.str();
  return s;
}
const int SIZE = 100 + 10;
vector<int> G[SIZE];
map<int, pair<int, int> > MAP1;
map<pair<int, int>, int> MAP2;
int visited[SIZE];
void DFS(int u) {
  visited[u] = 1;
  int I, v;
  for (I = 0; I < G[u].size(); I++) {
    v = G[u][I];
    if (visited[v] == 0) DFS(v);
  }
}
int main() {
  std::ios_base::sync_with_stdio(0);
  int T, I, J, K, N, n, m, cnt = 0, len, u, v, x, y, a, b, Q, c, d;
  cin >> n;
  int idx = 1;
  for (I = 0; I < n; I++) {
    cin >> Q;
    if (Q == 1) {
      cin >> x >> y;
      MAP1[idx++] = pair<int, int>(x, y);
      MAP2[pair<int, int>(x, y)] = idx - 1;
      if (idx >= 2) {
        a = x, b = y;
        for (J = 1; J < idx; J++) {
          c = MAP1[J].first, d = MAP1[J].second;
          if ((c < a && a < d) || (c < b && b < d)) {
            u = MAP2[pair<int, int>(a, b)];
            v = MAP2[pair<int, int>(c, d)];
            G[u].push_back(v);
          }
          if ((a < c && c < b) || (a < d && d < b)) {
            u = MAP2[pair<int, int>(c, d)];
            v = MAP2[pair<int, int>(a, b)];
            G[u].push_back(v);
          }
        }
      }
    } else {
      cin >> u >> v;
      memset(visited, 0, sizeof(visited));
      DFS(u);
      if (visited[v] == 1)
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
  return 0;
}
