#include <bits/stdc++.h>
using namespace std;
const int maxN = 100005;
int n, s, m, cnt, sid[maxN], g[maxN], lef[maxN], rig[maxN], x[maxN], y[maxN],
    t[maxN];
struct Query {
  int k, val, typ;
} d[maxN * 2];
vector<int> tree[maxN * 4];
bool cmp(Query u, Query v) { return u.val < v.val; }
void Init() {
  scanf("%d", &n);
  s = cnt = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &t[i], &x[i], &y[i]);
    if (t[i] == 1) {
      s++;
      d[s].k = i;
      d[s].val = x[i];
      d[s].typ = 1;
      s++;
      d[s].k = i;
      d[s].val = y[i];
      d[s].typ = 2;
      cnt++;
      sid[cnt] = i;
    }
  }
  sort(d + 1, d + 1 + s, cmp);
  m = 0;
  d[0].val = -1000000001;
  for (int i = 1; i <= s; i++) {
    m += (d[i - 1].val != d[i].val);
    if (d[i].typ == 1)
      x[d[i].k] = m;
    else
      y[d[i].k] = m;
  }
}
int Getg(int u) {
  if (g[u] == u) return g[u];
  return g[u] = Getg(g[u]);
}
void addTree(int i, int le, int ri, int x, int y, int val) {
  if ((le > y) || (ri < x)) return;
  if ((x <= le) && (ri <= y)) {
    tree[i].push_back(val);
    return;
  }
  int mid = (le + ri) / 2;
  addTree(i * 2, le, mid, x, y, val);
  addTree(i * 2 + 1, mid + 1, ri, x, y, val);
}
void updateTree(int i, int le, int ri, int x, int val) {
  if ((le > x) || (ri < x)) return;
  int len = tree[i].size();
  for (int j = 0; j < len; j++) {
    lef[val] = min(lef[val], lef[tree[i][j]]);
    rig[val] = max(rig[val], rig[tree[i][j]]);
    g[Getg(tree[i][j])] = val;
  }
  tree[i].clear();
  if (le == ri) return;
  int mid = (le + ri) / 2;
  updateTree(i * 2, le, mid, x, val);
  updateTree(i * 2 + 1, mid + 1, ri, x, val);
}
void Work() {
  lef[0] = 2 * n + 1;
  rig[0] = 0;
  for (int i = 1; i <= n; i++)
    if (t[i] == 1) {
      g[i] = i;
      lef[i] = x[i];
      rig[i] = y[i];
      updateTree(1, 1, m, x[i], i);
      updateTree(1, 1, m, y[i], i);
      if (lef[i] + 1 < rig[i]) addTree(1, 1, m, lef[i] + 1, rig[i] - 1, i);
    } else {
      int u = sid[x[i]], v = sid[y[i]];
      int gx = Getg(u), gy = Getg(v);
      if ((lef[gy] <= lef[gx]) && (rig[gx] <= rig[gy]))
        printf("YES\n");
      else
        printf("NO\n");
    }
}
int main() {
  Init();
  Work();
  return 0;
}
