#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int l[100005], r[100005], fr[100005], to[100005];
int f[100005];
vector<int> v[600000];
int fa[100005], it[100005];
int getfa(int x) { return (x == fa[x]) ? x : (fa[x] = getfa(fa[x])); }
void merge(int x, int y) {
  if (x == y) return;
  x = getfa(x);
  y = getfa(y);
  if (x == y) return;
  l[x] = min(l[x], l[y]);
  r[x] = max(r[x], r[y]);
  fa[y] = x;
}
void update(int x, int l, int r, int tl, int tr, int p) {
  if (l > tr || tl > r) return;
  if (l >= tl && r <= tr) {
    v[x].emplace_back(p);
    return;
  }
  int mid = (l + r) >> 1;
  update(x << 1, l, mid, tl, tr, p);
  update((x << 1) | 1, mid + 1, r, tl, tr, p);
}
void get(int x, int l, int r, int p, int id) {
  bool f = v[x].empty();
  for (auto u : v[x]) merge(u, id);
  v[x].clear();
  if (!f) v[x].emplace_back(id);
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (p <= mid)
    get(x << 1, l, mid, p, id);
  else
    get((x << 1) | 1, mid + 1, r, p, id);
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  vector<int> v;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> f[i];
    if (f[i] == 1) {
      cin >> l[i] >> r[i];
      v.emplace_back(l[i]);
      v.emplace_back(r[i]);
    } else {
      cin >> fr[i] >> to[i];
    }
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  for (int i = 1; i <= n; i++) {
    if (f[i] == 2) continue;
    l[i] = lower_bound(v.begin(), v.end(), l[i]) - v.begin() + 1;
    r[i] = lower_bound(v.begin(), v.end(), r[i]) - v.begin() + 1;
  }
  int len = v.size(), cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (f[i] == 1) {
      fa[i] = i;
      it[++cnt] = i;
      if (l[i] < r[i] - 1) update(1, 1, len, l[i] + 1, r[i] - 1, i);
      get(1, 1, len, l[i], i);
      get(1, 1, len, r[i], i);
    } else {
      int t1 = getfa(it[fr[i]]), t2 = getfa(it[to[i]]);
      if (l[t1] > l[t2] && l[t1] < r[t2] || r[t1] > l[t2] && r[t1] < r[t2] ||
          t1 == t2) {
        cout << "YES\n";
      } else
        cout << "NO\n";
    }
  }
  return 0;
}
