#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 5e3 + 5;
const int logN = 20, BL = 400;
const double EPS = 3e-16;
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};
long long q;
vector<long long> adj[N];
bool used[N];
map<pair<long long, long long>, long long> m;
void dfs(long long v) {
  used[v] = true;
  for (auto to : adj[v]) {
    if (!used[to]) {
      dfs(to);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> q;
  long long cnt = 0;
  while (q--) {
    long long type;
    cin >> type;
    if (type == 1) {
      long long x, y;
      cin >> x >> y;
      cnt++;
      for (auto it : m) {
        long long l = it.first.first, r = it.first.second;
        if ((x < l && l < y) || (x < r && r < y)) {
          adj[it.second].push_back(cnt);
        }
        if ((l < x && x < r) || (l < y && y < r)) {
          adj[cnt].push_back(it.second);
        }
      }
      m[{x, y}] = cnt;
    } else {
      long long a, b;
      cin >> a >> b;
      memset(used, false, sizeof(used));
      dfs(a);
      if (used[b])
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
  return 0;
}
