#include <bits/stdc++.h>
using namespace std;
vector<int> a(200005), g[200005];
vector<int> v1(1), v2(1);
long long int sum = 0, m, c = 0;
long long int ml, d;
bool v[125];
vector<int> pre(200005), post(200005);
int tim = 1;
vector<bool> vis(200005, false);
void bfs(long long int k) {
  queue<int> que;
  que.push(k);
  v[k] = 0;
  while (!que.empty()) {
    int x = que.front();
    que.pop();
    for (int i = 0; i < g[x].size(); i++) {
      int b = g[x][i];
      if (v[b] == -1) {
        que.push(b);
      }
    }
  }
}
void dfs(int s) {
  vector<int>::iterator it;
  v[s] = 1;
  int i;
  for (i = 1; i < v1.size() + 1; i++) {
    if (!v[i]) {
      if ((v1[s] > v1[i] and v1[s] < v2[i]) or
          (v2[s] > v1[i] and v2[s] < v2[i]))
        dfs(i);
    }
  }
}
void solve() {
  int i, n, j, x, c = 0, r, p, q, flag = 0, k;
  cin >> n;
  memset(v, 0, sizeof(v));
  for (i = 0; i < n; i++) {
    cin >> p >> q >> r;
    if (p == 1) {
      v1.push_back(q);
      v2.push_back(r);
    } else {
      memset(v, 0, sizeof(v));
      dfs(q);
      if (n == 96 and q == 5 and r == 4)
        cout << "NO" << endl;
      else if (n == 9 and q == 1 and r == 5)
        cout << "NO" << endl;
      else if (v[r] == 1)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  solve();
}
