#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  int f = 0, c = getchar();
  x = 0;
  while (!isdigit(c)) f |= c == 45, c = getchar();
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (f) x = -x;
}
template <typename T, typename... Args>
inline void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
namespace run {
const int maxn = 1e5 + 10;
struct line {
  int op, l, r;
} a[maxn];
int b[maxn << 1], fa[maxn], L[maxn], R[maxn];
int n, m, num;
vector<int> v[maxn << 2];
inline bool check(int pos, int l, int r) { return l < pos && pos < r; }
inline int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
inline void update(int root, int l, int r, int pos, int val) {
  if (v[root].size()) {
    for (register int i = 0; i < v[root].size(); ++i) {
      int y = v[root][i];
      y = find(y);
      fa[y] = val;
      L[val] = min(L[val], L[y]);
      R[val] = max(R[val], R[y]);
    }
    v[root].clear();
    v[root].push_back(val);
  }
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (pos <= mid)
    update(root << 1, l, mid, pos, val);
  else
    update(root << 1 | 1, mid + 1, r, pos, val);
  return;
}
inline void pushdown(int root, int l, int r, int al, int ar, int val) {
  if (l > ar || r < al) return;
  if (al <= l && r <= ar) {
    v[root].push_back(val);
    return;
  }
  int mid = (l + r) >> 1;
  pushdown(root << 1, l, mid, al, ar, val);
  pushdown(root << 1 | 1, mid + 1, r, al, ar, val);
  return;
}
inline int main() {
  read(m);
  for (register int i = 1; i <= m; ++i) {
    read(a[i].op, a[i].l, a[i].r);
    if (a[i].op == 1) b[++n] = a[i].l, b[++n] = a[i].r;
  }
  sort(b + 1, b + 1 + n);
  n = unique(b + 1, b + 1 + n) - b - 1;
  for (register int i = 1; i <= m; ++i) {
    if (a[i].op == 1) {
      a[i].l = lower_bound(b + 1, b + 1 + n, a[i].l) - b;
      a[i].r = lower_bound(b + 1, b + 1 + n, a[i].r) - b;
      L[++num] = a[i].l, R[num] = a[i].r;
      fa[num] = num;
      update(1, 1, n, a[i].l, num);
      update(1, 1, n, a[i].r, num);
      if (a[i].l < a[i].r - 1) pushdown(1, 1, n, a[i].l + 1, a[i].r - 1, num);
    } else {
      int x = find(a[i].l), y = find(a[i].r);
      bool flg = x == y || check(L[x], L[y], R[y]) || check(R[x], L[y], R[y]);
      puts(flg ? "YES" : "NO");
    }
  }
  return 0;
}
}  // namespace run
int main() { return run ::main(); }
