#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  if (flag) x = -x;
}
int q, tot, cnt, root = 1;
int a[800010], lp[800010], rp[800010], fa[800010], num[800010];
vector<int> ve[800010];
struct node {
  int opt, l, r;
} p[800010];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void insert(int L, int R, int l, int r, int id, int cur) {
  if (L <= l && R >= r) {
    ve[cur].push_back(id);
    return;
  }
  if (L <= ((l + r) >> 1)) insert(L, R, l, ((l + r) >> 1), id, (cur << 1));
  if (R > ((l + r) >> 1))
    insert(L, R, ((l + r) >> 1) + 1, r, id, (cur << 1 | 1));
}
void query(int l, int r, int pos, int id, int cur) {
  if (ve[cur].size()) {
    for (int i = 0; i < ve[cur].size(); ++i) {
      int x = ve[cur][i];
      x = find(x), fa[x] = id;
      lp[id] = min(lp[id], lp[x]), rp[id] = max(rp[id], rp[x]);
    }
    ve[cur].clear(), ve[cur].push_back(id);
  }
  if (l == r) return;
  if (pos <= ((l + r) >> 1))
    query(l, ((l + r) >> 1), pos, id, (cur << 1));
  else
    query(((l + r) >> 1) + 1, r, pos, id, (cur << 1 | 1));
}
int main() {
  read(q);
  for (int i = 1; i <= q; ++i) {
    read(p[i].opt), read(p[i].l), read(p[i].r);
    if (p[i].opt == 1) a[++tot] = p[i].l, a[++tot] = p[i].r;
  }
  sort(a + 1, a + tot + 1), tot = unique(a + 1, a + tot + 1) - a - 1;
  for (int i = 1; i <= q; ++i) {
    if (p[i].opt == 1) {
      p[i].l = lower_bound(a + 1, a + tot + 1, p[i].l) - a;
      p[i].r = lower_bound(a + 1, a + tot + 1, p[i].r) - a;
      num[i] = ++cnt, fa[cnt] = cnt, lp[cnt] = p[i].l, rp[cnt] = p[i].r;
    }
  }
  for (int i = 1; i <= q; ++i) {
    if (p[i].opt == 1) {
      query(1, tot, p[i].l, num[i], root), query(1, tot, p[i].r, num[i], root);
      if (p[i].r - p[i].l + 1 >= 3)
        insert(p[i].l + 1, p[i].r - 1, 1, tot, num[i], root);
    } else {
      int x = find(p[i].l), y = find(p[i].r);
      if (x == y || (lp[y] < lp[x] && lp[x] < rp[y]) ||
          (lp[y] < rp[x] && rp[x] < rp[y]))
        puts("YES");
      else
        puts("NO");
    }
  }
  return 0;
}
