#include <bits/stdc++.h>
using namespace std;
int N, M, ttt;
int fa[100005];
set<pair<int, int> > al[3000005], ar[3000005];
set<pair<int, int> >::iterator it;
int ml[3000005], mr[3000005], son[3000005][2], pt;
int tl[100005], tr[100005];
int maxl, maxr, ql, qr, q1;
int tql, tqr;
void Upl(int& x, int y) {
  if (y != 0 && (x == 0 || tl[x] > tl[y])) x = y;
}
void Upr(int& x, int y) {
  if (y != 0 && (x == 0 || tr[x] < tr[y])) x = y;
}
int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
void Query(int now, int l, int r) {
  if (!now) return;
  if (ql <= l && qr >= r) {
    Upl(maxl, ml[now]);
    Upr(maxr, mr[now]);
    return;
  }
  int mid = (l + r) / 2;
  if (mid == r) mid--;
  if (ql <= mid) Query(son[now][0], l, mid);
  if (qr > mid) Query(son[now][1], mid + 1, r);
}
void Add(int now, int l, int r) {
  if (qr == 0)
    Upl(ml[now], q1);
  else
    Upr(mr[now], q1);
  if (l == r) {
    if (qr == 0)
      al[now].insert(make_pair(tl[q1], q1));
    else
      ar[now].insert(make_pair(-tr[q1], q1));
    return;
  }
  int mid = (l + r) / 2;
  if (mid == r) mid--;
  if (ql <= mid)
    Add((son[now][0] = son[now][0] ? son[now][0] : ++pt), l, mid);
  else
    Add((son[now][1] = son[now][1] ? son[now][1] : ++pt), mid + 1, r);
}
void Del(int now, int l, int r) {
  if (l == r) {
    if (qr == 0) {
      it = al[now].lower_bound(make_pair(tl[q1], 0));
      al[now].erase(it), it = al[now].begin();
      ml[now] = al[now].size() ? (*it).second : 0;
    } else {
      it = ar[now].lower_bound(make_pair(-tr[q1], 0));
      ar[now].erase(it), it = ar[now].begin();
      mr[now] = ar[now].size() ? (*it).second : 0;
    }
    return;
  }
  int mid = (l + r) / 2;
  if (mid == r) mid--;
  if (ql <= mid)
    Del(son[now][0], l, mid);
  else
    Del(son[now][1], mid + 1, r);
  ml[now] = mr[now] = 0;
  Upl(ml[now], ml[son[now][0]]);
  Upl(ml[now], ml[son[now][1]]);
  Upr(mr[now], mr[son[now][0]]);
  Upr(mr[now], mr[son[now][1]]);
}
int main() {
  int i, j, x, y, type, tmp;
  scanf("%d", &N), pt = 1;
  for (i = 1; i <= N; i++) {
    scanf("%d", &type);
    if (type == 1) {
      M++;
      scanf("%d %d", &tl[M], &tr[M]);
      fa[M] = M;
      tql = tl[M] + 1, tqr = tr[M] - 1;
      if (tql <= tqr) {
        while (1) {
          maxl = maxr = 0;
          ql = tql, qr = 1000000000;
          Query(1, -1000000000, 1000000000);
          if (maxl && tl[maxl] < ql - 1) {
            fa[find(maxl)] = M;
            tl[M] = min(tl[M], tl[maxl]), tr[M] = max(tr[M], tr[maxl]);
            ql = tr[maxl], qr = 0, q1 = maxl;
            Del(1, -1000000000, 1000000000);
            ql = tl[maxl], qr = 1, q1 = maxl;
            Del(1, -1000000000, 1000000000);
          } else
            break;
        }
        while (1) {
          maxr = maxr = 0;
          ql = -1000000000, qr = tqr;
          Query(1, -1000000000, 1000000000);
          if (maxr && tr[maxr] > qr + 1) {
            fa[find(maxr)] = M, tl[M] = min(tl[M], tl[maxr]),
            tr[M] = max(tr[M], tr[maxr]);
            ql = tl[maxr], qr = 1, q1 = maxr;
            Del(1, -1000000000, 1000000000);
            ql = tr[maxr], qr = 0, q1 = maxr;
            Del(1, -1000000000, 1000000000);
            ql = tql, qr = tqr;
          } else
            break;
        }
      }
      ql = tr[M], q1 = M, qr = 0;
      Add(1, -1000000000, 1000000000);
      ql = tl[M], q1 = M, qr = 1;
      Add(1, -1000000000, 1000000000);
    } else {
      scanf("%d %d", &x, &y);
      tmp = find(y);
      if (find(x) == tmp)
        printf("%s\n", 1 ? "YES" : "NO");
      else if (tl[tmp] <= tl[x] && tr[tmp] >= tr[x] &&
               (tr[tmp] - tl[tmp]) > (tr[x] - tl[x]))
        printf("%s\n", 1 ? "YES" : "NO");
      else
        printf("%s\n", 0 ? "YES" : "NO");
    }
  }
  return 0;
}
