#include <bits/stdc++.h>
using namespace std;
int n, q;
int ms[101][101];
int x[101];
int y[101];
int main() {
  scanf("%d", &q);
  while (q--) {
    int tp, a, b;
    scanf("%d %d %d", &tp, &a, &b);
    if (tp == 2)
      puts(ms[a][b] ? "YES" : "NO");
    else {
      ++n;
      x[n] = a;
      y[n] = b;
      for (int i = 1; i < n; ++i) {
        ms[n][i] = x[i] < x[n] && x[n] < y[i] || x[i] < y[n] && y[n] < y[i];
        ms[i][n] = x[n] < x[i] && x[i] < y[n] || x[n] < y[i] && y[i] < y[n];
      }
      for (int k = 1; k <= n; ++k)
        for (int i = 1; i <= n; ++i)
          for (int j = 1; j <= n; ++j)
            if (ms[i][k] && ms[k][j]) ms[i][j] = 1;
    }
  }
  return 0;
}
