#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
vector<pair<int, int>> v;
bool mark[maxn], ans;
int n, a, u, y, ck;
void dfs(int x, int y) {
  mark[x] = 1;
  if (x == y) {
    ans = true;
    return;
  }
  for (int i = 0; i < v.size(); i++)
    if (!mark[i] && ((v[i].first < v[x].first && v[x].first < v[i].second) ||
                     (v[i].first < v[x].second && v[x].second < v[i].second))) {
      dfs(i, y);
    }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ck >> u >> y;
    if (ck == 1)
      v.push_back({u, y});
    else {
      ans = false;
      memset(mark, 0, sizeof(mark));
      dfs(u - 1, y - 1);
      if (ans)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
}
