#include <bits/stdc++.h>
using namespace std;
struct que {
  int t, x, y;
  que(int _t = 0, int _x = 0, int _y = 0) : t(_t), x(_x), y(_y) {}
};
struct uf {
  vector<int> st, l, r;
  uf(int n) : st(n), l(n), r(n) {
    for (int i = 0; i < (n); ++i) {
      st[i] = i;
    }
  }
  int find(int a) {
    if (a == st[a]) {
      return a;
    }
    return st[a] = find(st[a]);
  }
  void unite(int a, int b) {
    a = find(a);
    b = find(b);
    if (a != b) {
      l[a] = min(l[a], l[b]);
      r[a] = max(r[a], r[b]);
      st[b] = a;
    }
  }
};
const int MAXS = 1 << 19;
vector<int> tr[MAXS];
int BASE;
void add(int a, int b, int x, int y, int p, int v) {
  if (a > b || b < x || a > y) {
    return;
  }
  if (x >= a && y <= b) {
    tr[p].push_back(v);
    return;
  }
  int mid = (x + y) / 2;
  add(a, b, x, mid, 2 * p, v);
  add(a, b, mid + 1, y, 2 * p + 1, v);
}
void merge(int a, int v, uf &U) {
  a += BASE;
  while (a > 0) {
    if (!tr[a].empty()) {
      while (!tr[a].empty()) {
        int w = tr[a].back();
        U.unite(v, w);
        tr[a].pop_back();
      }
      tr[a].push_back(U.find(v));
    }
    a >>= 1;
  }
}
int main(void) {
  int n;
  scanf("%d", &n);
  vector<que> Q(n);
  vector<int> X;
  for (int i = 0; i < (n); ++i) {
    scanf("%d%d%d", &Q[i].t, &Q[i].x, &Q[i].y);
    if (Q[i].t == 2) {
      --Q[i].x;
      --Q[i].y;
    } else {
      X.push_back(Q[i].x);
      X.push_back(Q[i].y);
    }
  }
  sort((X).begin(), (X).end());
  X.erase(unique((X).begin(), (X).end()), X.end());
  for (BASE = 1; BASE < ((int)((X).size())); BASE <<= 1)
    ;
  for (__typeof((Q).begin()) it = (Q).begin(); it != (Q).end(); ++it) {
    if (it->t == 1) {
      it->x = lower_bound((X).begin(), (X).end(), it->x) - X.begin();
      it->y = lower_bound((X).begin(), (X).end(), it->y) - X.begin();
    }
  }
  vector<pair<int, int> > P;
  uf U(n);
  for (__typeof((Q).begin()) it = (Q).begin(); it != (Q).end(); ++it) {
    const que &q = *it;
    if (q.t == 2) {
      int a = U.find(q.x), b = U.find(q.y);
      if (a == b || (U.l[a] >= U.l[b] && U.r[a] <= U.r[b])) {
        puts("YES");
      } else {
        puts("NO");
      }
    } else {
      int k = ((int)((P).size()));
      P.push_back(make_pair(it->x, it->y));
      U.l[k] = it->x;
      U.r[k] = it->y;
      add(it->x + 1, it->y - 1, 0, BASE - 1, 1, k);
      merge(it->x, k, U);
      merge(it->y, k, U);
    }
  }
  return 0;
}
