#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100, INF = 1e9 + 2;
int n, cnode, cnt, rt, fa[N], L[N], R[N], lch[N * 40], rch[N * 40];
vector<int> vec[N * 40];
int getfa(int x) { return x == fa[x] ? x : fa[x] = getfa(fa[x]); }
void merge(int x, int y) {
  x = getfa(x), y = getfa(y);
  L[x] = min(L[x], L[y]);
  R[x] = max(R[x], R[y]);
  fa[y] = x;
}
void ins(int &k, int l, int r, int ql, int qr, int id) {
  if (ql > qr) return;
  if (!k) k = ++cnode;
  if (ql <= l && r <= qr) {
    vec[k].push_back(id);
    return;
  }
  int mid = (l + r) >> 1;
  if (ql <= mid) ins(lch[k], l, mid, ql, qr, id);
  if (qr > mid) ins(rch[k], mid + 1, r, ql, qr, id);
}
void Link(int k, int l, int r, int tar, int id) {
  if (!k) return;
  for (auto v : vec[k]) merge(v, id);
  if (vec[k].size()) vec[k].resize(1);
  int mid = (l + r) >> 1;
  tar <= mid ? Link(lch[k], l, mid, tar, id)
             : Link(rch[k], mid + 1, r, tar, id);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int op, a, b;
    cin >> op >> a >> b;
    if (op == 1) {
      L[++cnt] = a, R[cnt] = b, fa[cnt] = cnt;
      ins(rt, -INF, INF, a + 1, b - 1, cnt);
      Link(rt, -INF, INF, a, cnt);
      Link(rt, -INF, INF, b, cnt);
    } else {
      int x = getfa(a), y = getfa(b);
      puts(L[x] >= L[y] && R[x] <= R[y] ? "YES" : "NO");
    }
  }
  return 0;
}
