#include <bits/stdc++.h>
using namespace std;
const long N = 1000L + 10;
const long long modulo = 1000000007L;
vector<pair<long, long> > interv;
bool memo[N][N];
bool visited[N];
void divideByZero(const char *error) {
  printf(error);
  fclose(stdout);
  int a = 234;
  a = a / (a - a);
}
bool canDirectly(long a, long b, long c, long d) {
  return (c < a && a < d) || (c < b && b < d);
}
void addInterval(long x, long y) {
  long n = interv.size();
  interv.push_back(make_pair(x, y));
  for (long i = 0; i < n; i++) {
    if (canDirectly(interv[i].first, interv[i].second, x, y)) {
      memo[i][n] = true;
    }
    if (canDirectly(x, y, interv[i].first, interv[i].second)) {
      memo[n][i] = true;
    }
  }
}
bool pathExists(long from, long to) {
  for (long i = 0; i < N; i++) visited[i] = false;
  long n = interv.size();
  queue<long> q;
  visited[from] = true;
  q.push(from);
  while (!q.empty()) {
    long v = q.front();
    if (v == to) return true;
    q.pop();
    for (long nb = 0; nb < n; nb++)
      if (memo[v][nb]) {
        if (visited[nb]) continue;
        visited[nb] = true;
        q.push(nb);
      }
  }
  return false;
}
int main() {
  long n;
  scanf("%ld ", &n);
  for (long i = 0; i < n; i++)
    for (long j = 0; j < n; j++) memo[i][j] = false;
  for (long i = 0; i < n; i++) {
    long mode, x, y;
    scanf("%ld %ld %ld", &mode, &x, &y);
    if (mode == 1)
      addInterval(x, y);
    else {
      if (pathExists(x - 1, y - 1))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
