#include <bits/stdc++.h>
using namespace std;
void FKCU(int a) {
  printf("FKCUYOU!!!! %d \n", a);
  exit(0);
}
int bfa[111111];
int cl[111111];
int cr[111111];
int siz[111111];
int bzhan[111111];
int top(int x) {
  int t = 0;
  bzhan[0] = x;
  for (; bfa[bzhan[t]] != bzhan[t] && t < 5000; t++)
    bzhan[t + 1] = bfa[bzhan[t]];
  if (t == 5000) FKCU(22);
  x = bzhan[t];
  while (t--) bfa[bzhan[t]] = x;
  return x;
}
void merge(int zhu, int cong) {
  zhu = top(zhu);
  cong = top(cong);
  if (zhu == cong) return;
  bfa[cong] = zhu;
  cl[zhu] = min(cl[zhu], cl[cong]);
  cr[zhu] = max(cr[zhu], cr[cong]);
  siz[zhu] += siz[cong];
}
struct Node {
  int key;
  Node *fa;
  Node *son[2];
  Node() : key(0), fa(0) { son[0] = son[1] = 0; }
};
Node *sroot[111111], *ROOT;
int n;
void rot(Node *x, int fx) {
  Node *y = x->fa, *z = y->fa;
  y->son[fx] = x->son[fx ^ 1];
  if (y->son[fx]) y->son[fx]->fa = y;
  y->fa = x;
  x->son[fx ^ 1] = y;
  x->fa = z;
  if (z) z->son[z->son[0] != y] = x;
}
void splay(Node *x) {
  Node *y, *z;
  int fx, fy;
  for (y = x->fa; y != 0; y = x->fa) {
    fx = y->son[0] != x;
    if ((z = y->fa) == 0) {
      rot(x, fx);
      break;
    }
    fy = z->son[0] != y;
    if (fx == fy) {
      rot(y, fy);
      rot(x, fx);
    } else {
      rot(x, fx);
      rot(x, fy);
    }
  }
  ROOT = x;
}
void splayside(Node *bb, Node *x) {
  Node *y, *z;
  int fx, fy;
  for (y = x->fa; y != bb; y = x->fa) {
    fx = y->son[0] != x;
    if ((z = y->fa) == bb) {
      rot(x, fx);
      break;
    }
    fy = z->son[0] != y;
    if (fx == fy) {
      rot(y, fy);
      rot(x, fx);
    } else {
      rot(x, fx);
      rot(x, fy);
    }
  }
}
Node *findL(int j) {
  Node *x = ROOT, *ret = 0;
  while (x != 0)
    if (cr[x->key] <= j)
      x = x->son[1];
    else {
      ret = x;
      x = x->son[0];
    }
  if (ret) splay(ret);
  return ret;
}
Node *findR(int j) {
  Node *x = ROOT, *ret = 0;
  while (x != 0)
    if (cl[x->key] >= j)
      x = x->son[0];
    else {
      ret = x;
      x = x->son[1];
    }
  if (ret) splay(ret);
  return ret;
}
Node *prev(Node *a) {
  if (a->son[0])
    for (a = a->son[0]; a->son[1]; a = a->son[1])
      ;
  else {
    for (; a->fa && a->fa->son[0] == a; a = a->fa)
      ;
    a = a->fa;
  }
  if (a) splay(a);
  return a;
}
Node *next(Node *a) {
  if (a->son[1])
    for (a = a->son[1]; a->son[0]; a = a->son[0])
      ;
  else {
    for (; a->fa && a->fa->son[1] == a; a = a->fa)
      ;
    a = a->fa;
  }
  if (a) splay(a);
  return a;
}
void lysis(Node *u) {
  Node *ul, *ur, *uc;
  if (u == 0 || bfa[u->key] != u->key) FKCU(1);
  merge(n, u->key);
  uc = sroot[u->key];
  ul = prev(u);
  ur = next(u);
  if (!ul && !ur) {
    if (ROOT != u || u->son[0] || u->son[1]) FKCU(11);
    ROOT = uc;
    return;
  }
  if (!ul) {
    if (ur->son[0] != u || u->son[0] || u->son[1]) FKCU(2);
    ur->son[0] = uc;
    if (uc) uc->fa = ur;
    return;
  }
  if (!ur) {
    if (ul->son[1] != u || u->son[0] || u->son[1]) FKCU(3);
    ul->son[1] = uc;
    if (uc) uc->fa = ul;
    return;
  }
  if (ROOT != ur) FKCU(4);
  splayside(ur, ul);
  if (ul->son[1] != u || u->son[0] || u->son[1]) FKCU(5);
  ul->son[1] = uc;
  if (uc) uc->fa = ul;
}
int Newl, Newr;
int ltop, rtop;
void QJins() {
  Node *u, *v;
  if (v = findR(Newr)) cr[n] = max(cr[n], cr[v->key]);
  if (u = findL(Newl)) cl[n] = min(cl[n], cl[u->key]);
  while (u && cl[u->key] < Newl) {
    lysis(u);
    u = findL(Newl);
  }
  v = findR(Newr);
  while (v && cr[v->key] > Newr) {
    lysis(v);
    v = findR(Newr);
  }
  u = findL(cl[n]);
  v = findR(cr[n]);
  Node *g = new Node();
  g->key = n;
  if (u == 0 && v == 0) {
    if (ROOT != 0) FKCU(13);
    ROOT = g;
    return;
  }
  if (v == 0) {
    splay(u);
    if (u->son[0] != 0) FKCU(14);
    u->son[0] = g;
    g->fa = u;
    return;
  }
  if (u == 0) {
    splay(v);
    if (v->son[1] != 0) FKCU(15);
    v->son[1] = g;
    g->fa = v;
    return;
  }
  if (cl[u->key] >= cr[v->key]) {
    splay(v);
    splay(u);
    if (u->son[0] != v || v->son[1] != 0) FKCU(16);
    v->son[1] = g;
    g->fa = v;
    return;
  }
  u = prev(u);
  v = next(v);
  if (u == 0 && v == 0) {
    sroot[n] = ROOT;
    ROOT = g;
    if (sroot[n] == 0) FKCU(6);
    sroot[n]->fa = 0;
    return;
  }
  if (u == 0) {
    sroot[n] = v->son[0];
    v->son[0] = g;
    g->fa = v;
    if (sroot[n] == 0) FKCU(7);
    sroot[n]->fa = 0;
    return;
  }
  if (v == 0) {
    sroot[n] = u->son[1];
    u->son[1] = g;
    g->fa = u;
    if (sroot[n] == 0) FKCU(8);
    sroot[n]->fa = 0;
    return;
  }
  splayside(v, u);
  sroot[n] = u->son[1];
  u->son[1] = g;
  g->fa = u;
  if (sroot[n] == 0) FKCU(9);
  sroot[n]->fa = 0;
}
inline void Newseg(int l, int r) {
  n++;
  if (n > 100000) FKCU(10);
  cl[n] = l;
  cr[n] = r;
  bfa[n] = n;
  siz[n] = 1;
}
int main() {
  int q, cmd, x, y;
  n = -1;
  Newseg(-1111111111, 1111111111);
  scanf("%d", &q);
  q--;
  scanf("%d%d%d", &cmd, &x, &y);
  if (cmd == 2)
    for (q = 1; 1; q++) sroot[q] = 0;
  ROOT = new Node();
  ROOT->key = 1;
  Newseg(x, y);
  sroot[1] = 0;
  while (q--) {
    scanf("%d%d%d", &cmd, &x, &y);
    if (cmd == 2) {
      x = top(x);
      y = top(y);
      if (x == y) {
        printf("YES\n");
        continue;
      }
      if (cl[x] < cl[y] || cr[x] > cr[y]) {
        printf("NO\n");
        continue;
      }
      if (cl[x] > cl[x] || cr[x] < cr[y]) {
        printf("YES\n");
        continue;
      }
      if (siz[x] == 1)
        printf("NO\n");
      else
        printf("YES\n");
    } else {
      Newseg(x, y);
      Newl = x;
      Newr = y;
      QJins();
    }
  }
  return 0;
}
