#include <bits/stdc++.h>
using namespace std;
bool vis[120];
int a[120];
int b[120];
int y;
void dfs(int i) {
  vis[i] = true;
  for (int k = 0; k < y; k++) {
    if (vis[k]) continue;
    if ((a[i] < b[k] && a[i] > a[k]) || (b[i] < b[k] && b[i] > a[k])) {
      dfs(k);
    }
  }
}
int main() {
  int n;
  cin >> n;
  y = 0;
  for (int i = 0; i < n; i++) {
    int u, v, c;
    cin >> c >> u >> v;
    if (c == 1) {
      a[y] = u;
      b[y] = v;
      y++;
    } else {
      memset(vis, 0, sizeof(vis));
      dfs(u - 1);
      if (vis[v - 1])
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
