#include <bits/stdc++.h>
using namespace std;
int x[1001000], y[1001000], l[1001000], r[1001000], siz[1001000], fa[1001000],
    n, m, op, o, p, cnt;
vector<int> s[1001000];
int ex[1001000], excnt, size, i, ti;
struct node {
  int op, o, p;
} q[1001000];
inline int read() {
  int x = 0, y = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') y = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * y;
}
int find(int x) {
  if (fa[x] == x) return x;
  fa[x] = find(fa[x]);
  return fa[x];
}
int calc(int x) { return lower_bound(ex + 1, ex + 1 + size, x) - ex; }
void merge(int x, int y) {
  int f1 = find(x), f2 = find(y);
  if (f1 == f2) return;
  if (siz[f1] < siz[f2]) swap(f1, f2);
  siz[f1] += siz[f2], fa[f2] = f1;
  l[f1] = min(l[f1], l[f2]);
  r[f1] = max(r[f1], r[f2]);
}
void query(int rt, int l, int r, int x) {
  int nn = s[rt].size();
  for (int i = 0; i < nn; i++) merge(s[rt][i], n);
  s[rt].clear();
  if (l == r) return;
  if (x <= ((l + r) / 2))
    query((rt << 1), l, ((l + r) / 2), x);
  else
    query((rt << 1 | 1), ((l + r) / 2) + 1, r, x);
}
void modify(int rt, int l, int r, int x, int y, int d) {
  if (x <= l && r <= y) {
    s[rt].push_back(d);
    return;
  }
  if (x <= ((l + r) / 2)) modify((rt << 1), l, ((l + r) / 2), x, y, d);
  if (y >= ((l + r) / 2) + 1)
    modify((rt << 1 | 1), ((l + r) / 2) + 1, r, x, y, d);
}
int main() {
  scanf("%d", &m);
  for (i = 1; i <= m; i++) {
    op = read(), o = read(), p = read();
    q[i] = (node){op, o, p};
    if (op == 1)
      ex[++excnt] = o, ex[++excnt] = p, ex[++excnt] = o + 1,
      ex[++excnt] = p - 1;
  }
  sort(ex + 1, ex + 1 + excnt);
  size = unique(ex + 1, ex + 1 + excnt) - ex - 1;
  for (i = 1; i <= m; i++) {
    if (q[i].op == 1) {
      o = q[i].o, p = q[i].p;
      o++;
      p--;
      n++;
      fa[n] = n, l[n] = o, r[n] = p;
      x[n] = o - 1, y[n] = p + 1, siz[n] = 1;
      query(1, 1, size, calc(o - 1));
      query(1, 1, size, calc(p + 1));
      modify(1, 1, size, calc(l[find(n)]), calc(r[find(n)]), n);
    } else {
      o = q[i].o, p = q[i].p;
      int f = 0;
      int f1 = find(o), f2 = find(p);
      if (f1 == f2) f = 1;
      if (x[o] >= l[f2] && x[o] <= r[f2]) f = 1;
      if (y[o] >= l[f2] && y[o] <= r[f2]) f = 1;
      if (f)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
