#include <bits/stdc++.h>
using namespace std;
const int MX = (1 << 20);
pair<int, int> arr[MX];
int n, cmd, add = 0;
bool vi[MX];
void dfs(int src, int snk) {
  vi[src] = 1;
  int x = src, nxt;
  if (src == snk) return;
  for (int j = 1; j <= add; j++) {
    nxt = j;
    x = src;
    if (vi[nxt]) continue;
    swap(x, nxt);
    if (arr[nxt].first > arr[x].first && arr[nxt].first < arr[x].second) {
      dfs(x, snk);
      continue;
    }
    if (arr[nxt].second > arr[x].first && arr[nxt].second < arr[x].second) {
      dfs(x, snk);
      continue;
    }
  }
}
int main() {
  cin >> n;
  int a, b, cmd;
  while (n--) {
    cin >> cmd >> a >> b;
    if (cmd == 1) {
      arr[++add] = make_pair(a, b);
    } else {
      memset(vi, 0, sizeof(vi));
      dfs(a, b);
      if (vi[b])
        puts("YES");
      else
        puts("NO");
    }
  }
}
