#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int dad[MAXN], L[MAXN], R[MAXN], N, added;
struct cmp {
  bool operator()(int a, int b) { return L[a] < L[b]; }
};
set<int, cmp> *child[MAXN];
int root(int a) {
  if (dad[a] == a) return a;
  return dad[a] = root(dad[a]);
}
void merge(int node) {
  if (child[added]->size() > child[node]->size()) {
    swap(child[added], child[node]);
  }
  for (auto i = child[node]->begin(); i != child[node]->end(); ++i) {
    child[added]->insert(*i);
  }
  dad[node] = added;
  L[added] = min(L[added], L[node]);
  R[added] = max(R[added], R[node]);
}
void go(int x, int p) {
  L[N + 1] = p;
  auto it = child[x]->lower_bound(N + 1);
  if (it == child[x]->begin()) return;
  --it;
  int node = *it;
  if (R[node] <= p) return;
  go(node, p);
  merge(*it);
  child[x]->erase(it);
}
void search(int x) {
  auto it = child[x]->upper_bound(added);
  if (it != child[x]->begin()) {
    --it;
    if (L[*it] <= L[added] && R[added] <= R[*it] &&
        (L[*it] != L[added] || R[*it] != R[added])) {
      search(*it);
      merge(*it);
      child[x]->erase(*it);
      return;
    }
  }
  int a = L[added], b = R[added];
  go(x, a);
  go(x, b);
}
int main() {
  scanf("%d", &N);
  child[0] = new set<int, cmp>();
  for (int i = 1; i <= N; ++i) {
    int type, a, b;
    scanf("%d%d%d", &type, &a, &b);
    if (type == 1) {
      L[++added] = a;
      R[added] = b;
      dad[added] = added;
      child[added] = new set<int, cmp>();
      search(0);
      for (auto j = child[0]->lower_bound(added); j != child[0]->end();) {
        int node = *j;
        if (L[node] >= R[added]) break;
        child[added]->insert(node);
        child[0]->erase(j++);
      }
      child[0]->insert(added);
    } else {
      a = root(a);
      b = root(b);
      if (L[b] <= L[a] && R[a] <= R[b] && a <= b) {
        printf("YES\n");
      } else {
        printf("NO\n");
      }
    }
  }
}
