#include <bits/stdc++.h>
using namespace std;
int ata[(int)1e5 + 10], L[(int)1e5 + 10], R[(int)1e5 + 10];
int s;
unordered_map<int, vector<int> > ST;
int atabul(int x) {
  if (ata[x] == x) return x;
  return ata[x] = atabul(ata[x]);
}
void merge(int x, int y) {
  y = atabul(y);
  L[s] = min(L[s], L[y]);
  R[s] = max(R[s], R[y]);
  ata[y] = s;
}
void calc(int root, int bas, int son, int t) {
  if (bas > t || son < t) return;
  int i;
  for (i = 0; i < ST[root].size(); i++) merge(s, ST[root][i]);
  ST[root].clear();
  if (bas == son) return;
  calc((root << 1), bas, ((bas + son) >> 1), t);
  calc(((root << 1) | 1), ((bas + son) >> 1) + 1, son, t);
}
void add(int root, int bas, int son, int x, int y) {
  if (bas > y || son < x) return;
  if (x <= bas && son <= y) {
    ST[root].push_back(s);
    return;
  }
  add((root << 1), bas, ((bas + son) >> 1), x, y);
  add(((root << 1) | 1), ((bas + son) >> 1) + 1, son, x, y);
}
int main() {
  int n, a, x, y, i;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a >> x >> y;
    if (a == 1) {
      ++s;
      ata[s] = s;
      L[s] = x;
      R[s] = y;
      calc(1, -1000000007, 1000000007, x);
      calc(1, -1000000007, 1000000007, y);
      if (x + 1 < y) add(1, -1000000007, 1000000007, L[s] + 1, R[s] - 1);
    } else {
      x = atabul(x);
      y = atabul(y);
      int a = L[x], b = R[x], c = L[y], d = R[y];
      if (x == y || (c < a && a < d) || (c < b && b < d))
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}
