#include <bits/stdc++.h>
const int N = 1 << 17;
int n, op[N], a[N], b[N];
int anc[N], l[N], r[N];
inline int find(int x) { return (anc[x] == x) ? x : (anc[x] = find(anc[x])); }
inline void join(int u, int v) {
  u = find(u), v = find(v);
  if (u != v) {
    l[v] = std::min(l[v], l[u]);
    r[v] = std::max(r[v], r[u]);
    anc[u] = v;
  }
}
std::set<int> pool[N * 4];
void merge(int id, int l, int r, int pos, int val) {
  for (std::set<int>::iterator it = pool[id].begin(); it != pool[id].end();
       ++it)
    join(*it, val);
  pool[id].clear();
  if (l == r) return;
  int mid = (l + r) / 2;
  if (pos <= mid)
    merge(id << 1, l, mid, pos, val);
  else
    merge(id << 1 | 1, mid + 1, r, pos, val);
}
void update(int id, int l, int r, int a, int b, int val) {
  if (a <= l && r <= b) {
    pool[id].insert(val);
    return;
  }
  int mid = (l + r) / 2;
  if (a <= mid) update(id << 1, l, mid, a, b, val);
  if (b > mid) update(id << 1 | 1, mid + 1, r, a, b, val);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) anc[i] = i;
  static std::vector<int> sorted;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d%d", op + i, a + i, b + i);
    if (op[i] == 2) continue;
    sorted.push_back(a[i]);
    sorted.push_back(b[i]);
  }
  std::sort(sorted.begin(), sorted.end());
  sorted.erase(std::unique(sorted.begin(), sorted.end()), sorted.end());
  int tot = sorted.size() - 1;
  for (int i = 0; i <= tot; ++i) anc[i] = i;
  for (int i = 1, id = 0; i <= n; ++i) {
    switch (op[i]) {
      case 1:
        id++;
        a[i] = std::lower_bound(sorted.begin(), sorted.end(), a[i]) -
               sorted.begin();
        b[i] = std::lower_bound(sorted.begin(), sorted.end(), b[i]) -
               sorted.begin();
        l[id] = a[i];
        r[id] = b[i];
        anc[id] = id;
        merge(1, 0, tot, a[i], id);
        merge(1, 0, tot, b[i], id);
        if (l[find(id)] + 1 <= r[find(id)] - 1)
          update(1, 0, tot, l[find(id)] + 1, r[find(id)] - 1, id);
        break;
      case 2:
        a[i] = find(a[i]), b[i] = find(b[i]);
        puts((a[i] == b[i] || (l[b[i]] <= l[a[i]] && r[a[i]] <= r[b[i]]))
                 ? "YES"
                 : "NO");
        break;
    }
  }
  return 0;
}
