#include <bits/stdc++.h>
using namespace std;
const int N = 602000;
struct QUERY {
  int ord, a, b;
} q[N];
int n, fa[N], segL[N], segR[N];
int ns, seq[N], nl[N], nr[N];
vector<int> tree[3 * N];
int find(int a) { return a == fa[a] ? a : fa[a] = find(fa[a]); }
inline void uni(int a, int b) {
  a = find(a);
  b = find(b);
  nl[a] = min(nl[a], nl[b]);
  nr[a] = max(nr[a], nr[b]);
  fa[b] = a;
}
void init(int l, int r, int id) {
  tree[id].clear();
  if (l == r) return;
  int m = (l + r) / 2, lc = id * 2 + 1, rc = id * 2 + 2;
  init(l, m, lc);
  init(m + 1, r, rc);
}
void insert(int l, int r, int fl, int fr, int v, int id) {
  if (l == fl && r == fr) {
    tree[id].push_back(v);
    return;
  }
  int m = (l + r) / 2, lc = id * 2 + 1, rc = id * 2 + 2;
  if (fr <= m) {
    insert(l, m, fl, fr, v, lc);
  } else if (m < fl) {
    insert(m + 1, r, fl, fr, v, rc);
  } else {
    insert(l, m, fl, m, v, lc);
    insert(m + 1, r, m + 1, fr, v, rc);
  }
}
void query(int l, int r, int fn, int v, int id) {
  for (__typeof(tree[id].begin()) it = tree[id].begin(); it != tree[id].end();
       it++)
    uni(*it, v);
  tree[id].clear();
  if (l == r) return;
  int m = (l + r) / 2, lc = id * 2 + 1, rc = id * 2 + 2;
  if (fn <= m)
    query(l, m, fn, v, lc);
  else
    query(m + 1, r, fn, v, rc);
}
int main(int argc, char** argv) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d", &q[i].ord, &q[i].a, &q[i].b);
    if (q[i].ord == 1) {
      seq[ns++] = q[i].a - 1;
      seq[ns++] = q[i].a;
      seq[ns++] = q[i].a + 1;
      seq[ns++] = q[i].b - 1;
      seq[ns++] = q[i].b;
      seq[ns++] = q[i].b + 1;
    }
    fa[i] = i;
  }
  sort(seq, seq + ns);
  ns = unique(seq, seq + ns) - seq;
  int rn = 1;
  init(0, ns - 1, 0);
  for (int i = 1; i <= n; i++) {
    if (q[i].ord == 1) {
      int id1 = lower_bound(seq, seq + ns, q[i].a) - seq;
      int id2 = lower_bound(seq, seq + ns, q[i].b) - seq;
      segL[rn] = nl[rn] = q[i].a;
      segR[rn] = nr[rn] = q[i].b;
      query(0, ns - 1, id1, rn, 0);
      query(0, ns - 1, id2, rn, 0);
      int l = nl[find(rn)];
      int r = nr[find(rn)];
      l = lower_bound(seq, seq + ns, l) - seq;
      r = lower_bound(seq, seq + ns, r) - seq;
      if (q[i].a != q[i].b - 1) insert(0, ns - 1, l + 1, r - 1, rn, 0);
      rn++;
    } else {
      if (find(q[i].a) == find(q[i].b))
        puts("YES");
      else {
        int a = q[i].a;
        int b = find(q[i].b);
        if (nl[b] < segL[a] && segL[a] < nr[b] ||
            nl[b] < segR[a] && segR[a] < nr[b])
          puts("YES");
        else
          puts("NO");
      }
    }
  }
  return 0;
}
