#include <bits/stdc++.h>
using namespace std;
bool debug = false;
int n, m, k;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long ln, lk, lm;
int f[100005], X[100005], Y[100005], root;
struct node {
  int l, r;
  vector<int> q;
} T[100005 * 4];
int cnt, S;
int ff(int x) { return x == f[x] ? x : f[x] = ff(f[x]); }
void join(int &rt, int l, int r, int x) {
  if (rt == 0) return;
  for (int c : T[rt].q) {
    int fc = ff(c);
    X[cnt] = min(X[cnt], X[fc]);
    Y[cnt] = max(Y[cnt], Y[fc]);
    f[fc] = cnt;
  }
  T[rt].q.clear();
  int mid = (l + r) >> 1;
  if (l == r) return;
  if (x <= mid)
    join(T[rt].l, l, mid, x);
  else
    join(T[rt].r, mid + 1, r, x);
}
void update(int &rt, int l, int r, int L, int R) {
  if (rt == 0) rt = ++S;
  if (r <= R && L <= l) {
    T[rt].q.push_back(cnt);
    return;
  }
  int mid = (l + r) >> 1;
  if (R <= mid)
    update(T[rt].l, l, mid, L, R);
  else if (mid < L) {
    update(T[rt].r, mid + 1, r, L, R);
  } else {
    update(T[rt].l, l, mid, L, mid);
    update(T[rt].r, mid + 1, r, mid + 1, R);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0, u, v, t; i < n; i++) {
    scanf("%d%d%d", &t, &u, &v);
    if (t == 1) {
      ++cnt;
      X[cnt] = u;
      Y[cnt] = v;
      f[cnt] = cnt;
      join(root, -1e9, 1e9, u);
      join(root, -1e9, 1e9, v);
      if (X[cnt] + 1 < Y[cnt]) {
        update(root, -1e9, 1e9, X[cnt] + 1, Y[cnt] - 1);
      }
    } else {
      int fu = ff(u), fv = ff(v);
      if (fu == fv)
        puts("YES");
      else if (X[fu] >= X[fv] && Y[fu] <= Y[fv] &&
               !(X[fu] == X[fv] && Y[fu] == Y[fv])) {
        puts("YES");
      } else
        puts("NO");
    }
  }
  return 0;
}
