#include <bits/stdc++.h>
using namespace std;
struct node {
  int nr;
  node *next;
} * l[101];
int vx[101], vy[101], t;
bool viz[101];
void create_edge(int a, int b) {
  node *d = new node;
  d->nr = b;
  d->next = l[a];
  l[a] = d;
}
void add(int x, int y) {
  vx[++t] = x;
  vy[t] = y;
  for (int i = 1; i < t; i++) {
    if (vx[i] < x && x < vy[i] || vx[i] < y && y < vy[i]) create_edge(t, i);
    if (x < vx[i] && vx[i] < y || x < vy[i] && vy[i] < y) create_edge(i, t);
  }
}
int dfs(int x, int y) {
  viz[x] = 1;
  int ok = 0;
  for (node *d = l[x]; d != NULL; d = d->next) {
    if (!viz[d->nr]) {
      if (d->nr == y) return 1;
      ok = ok + dfs(d->nr, y);
    }
  }
  return ok;
}
int main() {
  int n, o, x, y, i, yes;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> o >> x >> y;
    if (o == 1)
      add(x, y);
    else {
      for (int j = 1; j <= t; j++) viz[j] = 0;
      yes = dfs(x, y);
      if (yes)
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}
