#include <bits/stdc++.h>
char ch;
inline void read(int &x) {
  x = 0;
  ch = getchar();
  while (ch <= 32) ch = getchar();
  int f = 1;
  if (ch == '-') f = -1, ch = getchar();
  while (ch > 32) {
    x = x * 10 + ch - 48;
    ch = getchar();
  };
  x *= f;
};
inline int min(int a, int b) { return a < b ? a : b; };
inline int max(int a, int b) { return a > b ? a : b; };
int L[100005], R[100005];
int _L[100005], _R[100005];
struct DSU {
  int fa[100005];
  inline int getfa(int x) { return fa[x] ? fa[x] = getfa(fa[x]) : x; };
  inline void merge(int x, int y) {
    x = getfa(x);
    y = getfa(y);
    if (x == y) return;
    int t;
    if (x > y) t = x, x = y, y = t;
    fa[x] = y;
    L[y] = min(L[y], L[x]);
    R[y] = max(R[y], R[x]);
  };
} dsu;
int n;
int _op[100005], _a[100005], _b[100005];
int a1[100005 * 2];
std::vector<int> tr[262144 * 2];
inline void merge(std::vector<int> &a, int x) {
  int i;
  int sz = a.size();
  for (i = 0; i < sz; i++) {
    dsu.merge(a[i], x);
  };
  a.clear();
};
inline void merge(int id, int x) {
  x += 262144;
  while (x) {
    merge(tr[x], id);
    x >>= 1;
  };
};
inline void cover(int l, int r, int id) {
  if (l > r) return;
  l += 262144 - 1;
  r += 262144 + 1;
  while (l ^ r ^ 1) {
    if (~l & 1) tr[l ^ 1].push_back(id);
    if (r & 1) tr[r ^ 1].push_back(id);
    l >>= 1;
    r >>= 1;
  };
};
inline void insert(int id, int l, int r) {
  L[id] = l;
  R[id] = r;
  _L[id] = l;
  _R[id] = r;
  merge(id, l);
  merge(id, r);
  cover(L[id] + 1, R[id] - 1, id);
};
inline void query(int x, int y) {
  x = dsu.getfa(x);
  y = dsu.getfa(y);
  if (x == y || (x < y && ((L[y] < L[x] && L[x] < R[y]) ||
                           (L[y] < R[x] && R[x] < R[y])))) {
    puts("YES");
  } else {
    puts("NO");
  };
};
int main() {
  read(n);
  int i;
  for (i = 1; i <= n; i++) {
    read(_op[i]);
    read(_a[i]);
    read(_b[i]);
    if (_op[i] == 1) {
      a1[i] = _a[i];
      a1[i + n] = _b[i];
    };
  };
  std::sort(a1 + 1, a1 + n + n + 1);
  int cnt = 0;
  for (i = 1; i <= n; i++) {
    if (_op[i] == 1) {
      int l = std::lower_bound(a1 + 1, a1 + n + n + 1, _a[i]) - a1;
      int r = std::lower_bound(a1 + 1, a1 + n + n + 1, _b[i]) - a1;
      insert(++cnt, l, r);
    } else {
      query(_a[i], _b[i]);
    };
  };
}
