#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
const int maxm = 50 * maxn;
const int inf = 1e9;
int fa[maxn];
int get(int x) { return fa[x] == x ? x : fa[x] = get(fa[x]); }
struct tree {
  int l, r;
  vector<int> x;
} t[maxm];
struct node {
  int l, r;
} x[maxn];
int tot, l[maxn], r[maxn];
void merge(int x, int y) {
  x = get(x);
  y = get(y);
  fa[x] = y;
  l[y] = min(l[x], l[y]);
  r[y] = max(r[x], r[y]);
}
void insert(int p, int l, int r, int x, int y, int w) {
  if (l > y || r < x) return;
  if (l >= x && r <= y) {
    t[p].x.push_back(w);
    return;
  }
  int mid = (l + r) >> 1;
  if (t[p].l == 0) t[p].l = ++tot;
  insert(t[p].l, l, mid, x, y, w);
  if (t[p].r == 0) t[p].r = ++tot;
  insert(t[p].r, mid + 1, r, x, y, w);
}
void merge(int p, int l, int r, int x, int y) {
  while (t[p].x.size()) {
    merge(t[p].x[t[p].x.size() - 1], y);
    t[p].x.pop_back();
  }
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (mid >= x) {
    if (t[p].l) merge(t[p].l, l, mid, x, y);
  } else if (t[p].r)
    merge(t[p].r, mid + 1, r, x, y);
}
int m, num;
int main() {
  scanf("%d", &m);
  tot = 1;
  for (; m; m--) {
    int k1, k2, k3;
    scanf("%d%d%d", &k1, &k2, &k3);
    if (k1 == 1) {
      num++;
      l[num] = k2;
      r[num] = k3;
      x[num].l = k2;
      x[num].r = k3;
      fa[num] = num;
      merge(1, -inf, inf, k2, num);
      merge(1, -inf, inf, k3, num);
      insert(1, -inf, inf, l[num] + 1, r[num] - 1, num);
    } else {
      k3 = get(k3);
      if ((get(k2) == k3) || (l[k3] <= x[k2].l && r[k3] > x[k2].r))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
