#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
double eps = 0.000001;
int mp[105][105];
struct node {
  int x, y;
  node() {}
  node(int a, int b) {
    x = a;
    y = b;
  }
};
node tm[105];
int vis[105];
int n;
int dfs(int x, int y) {
  vis[x] = 1;
  if (x == y) return 1;
  int ret = 0;
  int i;
  for (i = 1; i <= n; i++) {
    if (mp[x][i] == 0 || vis[i]) continue;
    ret = dfs(i, y);
    if (ret) return 1;
  }
  return 0;
}
int main() {
  int ok = 0;
  cin >> n;
  int q, x, y;
  int i, j;
  for (i = 1; i <= n; i++) {
    scanf("%d%d%d", &q, &x, &y);
    if (q == 1) {
      tm[++ok] = node(x, y);
      for (j = 1; j < ok; j++) {
        int flag = 0;
        if (tm[ok].x < tm[j].x && tm[j].x < tm[ok].y) flag = 1;
        if (tm[ok].x < tm[j].y && tm[j].y < tm[ok].y) flag = 1;
        if (flag) mp[j][ok] = 1;
        flag = 0;
        if (tm[j].x < tm[ok].x && tm[ok].x < tm[j].y) flag = 1;
        if (tm[j].x < tm[ok].y && tm[ok].y < tm[j].y) flag = 1;
        if (flag) mp[ok][j] = 1;
      }
    } else {
      memset(vis, 0, sizeof(vis));
      if (dfs(x, y))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
