#include <bits/stdc++.h>
using namespace std;
struct Node {
  int st, ed;
  Node *l, *r;
  queue<int> v;
  Node() {}
  Node(int _st, int _ed, Node *_l, Node *_r) {
    st = _st;
    ed = _ed;
    l = _l;
    r = _r;
  }
};
const int maxn = 505050;
int f[maxn], l[maxn], r[maxn];
int n, m;
int ll[maxn], rr[maxn];
int find(int x) {
  if (f[x] == x) return x;
  return f[x] = find(f[x]);
}
void Union(int a, int b) {
  a = find(a);
  b = find(b);
  f[a] = b;
  l[b] = min(l[a], l[b]);
  r[b] = max(r[a], r[b]);
}
Node *tree(int st, int ed) {
  if (st == ed) return new Node(st, ed, 0, 0);
  return new Node(st, ed, tree(st, (st + ed) / 2), tree((st + ed) / 2 + 1, ed));
}
void merge(Node *now, int pos) {
  while (!now->v.empty()) {
    Union(now->v.front(), m);
    now->v.pop();
  }
  if (now->st == now->ed) return;
  if (pos <= now->l->ed)
    merge(now->l, pos);
  else
    merge(now->r, pos);
}
void add(Node *now, int st, int ed, int k) {
  if (now->st >= st && now->ed <= ed) {
    now->v.push(k);
    return;
  }
  if (now->l->ed >= st) add(now->l, st, ed, k);
  if (now->r->st <= ed) add(now->r, st, ed, k);
}
Node *root;
int x[maxn], y[maxn], z[maxn];
map<int, int> h;
int cnt = 0, cntt = 0;
int s[maxn];
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i] >> z[i];
    if (x[i] == 1) {
      s[++cnt] = y[i];
      s[++cnt] = z[i];
    }
  }
  sort(s + 1, s + 1 + cnt);
  for (int i = 1; i <= cnt; i++)
    if (h.find(s[i]) == h.end()) h[s[i]] = ++cntt;
  cnt = cntt;
  root = tree(1, cnt);
  for (int i = 1; i <= n; i++) {
    if (x[i] == 1) {
      y[i] = h[y[i]];
      z[i] = h[z[i]];
      m++;
      l[m] = ll[m] = y[i];
      r[m] = rr[m] = z[i];
      f[m] = m;
      merge(root, y[i]);
      merge(root, z[i]);
      if (l[m] + 2 <= r[m]) add(root, l[m] + 1, r[m] - 1, m);
    } else {
      z[i] = find(z[i]);
      if ((find(y[i]) == z[i]) || (l[z[i]] <= ll[y[i]]) && (r[z[i]] > rr[y[i]]))
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
