#include <bits/stdc++.h>
using namespace std;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
const long long MAXN = 1e6 + 10;
const long long INF = 8e18;
const long long MOD = 1e9 + 7;
vector<int> g[MAXN];
bool vis[MAXN];
pair<long long, long long> a[MAXN];
int n, x, y;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int I = 0;
  function<void(int)> dfs = [&](int u) {
    vis[u] = 1;
    for (auto node : g[u]) {
      if (!vis[node]) dfs(node);
    }
    return;
  };
  for (int query = 1; query <= n; query++) {
    int q;
    cin >> q >> x >> y;
    if (q == 1) {
      I++;
      a[I].first = x;
      a[I].second = y;
      for (int i = 1; i < I; i++) {
        if ((a[I].first < a[i].first and a[i].first < a[I].second) ||
            (a[I].first < a[i].second and a[i].second < a[I].second))
          g[i].emplace_back(I);
        if ((a[i].first < a[I].first and a[I].first < a[i].second) ||
            (a[i].first < a[I].second and a[I].second < a[i].second))
          g[I].emplace_back(i);
      }
      continue;
    }
    dfs(x);
    if (vis[y])
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
    memset(vis, 0, sizeof vis);
  }
  return 0;
}
