#include <bits/stdc++.h>
using namespace std;
pair<int, int> lr[105];
vector<int> Adj[105];
int ind = 0;
void add(int c, int d) {
  for (int i = 0; i < ind; i++) {
    if ((lr[i].first > c && lr[i].first < d) ||
        (lr[i].second > c && lr[i].second < d))
      Adj[i].push_back(ind);
    if ((c > lr[i].first && c < lr[i].second) ||
        (d > lr[i].first && d < lr[i].second))
      Adj[ind].push_back(i);
  }
}
bool V[105][105];
bool reach(int st, int end) {
  if (st == end) return true;
  if (V[st][end]) return false;
  V[st][end] = 1;
  for (int i = 0; i < Adj[st].size(); i++)
    if (reach(Adj[st][i], end)) return true;
  return false;
}
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    int A, B, C;
    scanf("%d%d%d", &A, &B, &C);
    ;
    if (A == 1) {
      lr[ind] = make_pair(B, C);
      add(B, C);
      ind++;
    } else {
      memset(V, 0, sizeof(V));
      if (reach(B - 1, C - 1))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}
