#include <bits/stdc++.h>
using namespace std;
inline int IN() {
  char c;
  register int first = 0;
  for (; (c = getchar()) < 48 && c ^ '-' || c > 57;)
    ;
  bool f = c == '-';
  if (f) (c = getchar());
  for (; c > 47 && c < 58; (c = getchar()))
    first = (first << 3) + (first << 1) + c - 48;
  if (f) first = -first;
  return first;
}
inline void glance() { freopen("ha.in", "r", stdin); }
typedef int Arr[400010];
int n, Q, LS, node;
Arr l, r, L, R, fa, X, Y, op, ls;
vector<int> li[1600010];
int get(int first) {
  return first ^ fa[first] ? fa[first] = get(fa[first]) : first;
}
inline void uni(int first, int second) {
  first = get(first);
  second = get(second);
  if (first == second) return;
  L[first] = min(L[first], L[second]);
  R[first] = max(R[first], R[second]);
  fa[second] = first;
}
void lu(int u, int ll, int rr, int pos) {
  if (li[u].size()) {
    for (int first : li[u]) uni(first, node);
    li[u].resize(0);
    li[u].push_back(node);
  }
  if (ll == rr) return;
  int mm = ll + rr >> 1;
  if (pos <= mm)
    lu(u << 1, ll, mm, pos);
  else
    lu(u << 1 | 1, mm + 1, rr, pos);
}
void gai(int u, int ll, int rr, int L, int R) {
  if (L <= ll && rr <= R) return li[u].push_back(node);
  int mm = ll + rr >> 1;
  if (L <= mm) gai(u << 1, ll, mm, L, R);
  if (R > mm) gai(u << 1 | 1, mm + 1, rr, L, R);
}
inline int Find(int first) {
  return lower_bound(ls + 1, ls + LS + 1, first) - ls;
}
int main() {
  Q = IN();
  for (int _r = Q, i = 1; i <= _r; ++i) {
    op[i] = IN();
    X[i] = IN();
    Y[i] = IN();
    if (op[i] == 1)
      ls[++LS] = X[i], ls[++LS] = Y[i], ls[++LS] = X[i] + 1,
      ls[++LS] = Y[i] - 1;
  }
  sort(ls + 1, ls + LS + 1);
  LS = unique(ls + 1, ls + LS + 1) - ls - 1;
  n = LS;
  for (int _r = Q, i = 1; i <= _r; ++i) {
    if (op[i] == 1) {
      int first = Find(X[i]), second = Find(Y[i]);
      ++node;
      L[node] = l[node] = first;
      R[node] = r[node] = second;
      fa[node] = node;
      lu(1, 1, n, first);
      lu(1, 1, n, second);
      if (second - first > 1) gai(1, 1, n, first + 1, second - 1);
    } else {
      int first = get(X[i]), second = get(Y[i]);
      puts(first == second || L[second] <= l[first] && r[first] <= R[second]
               ? "YES"
               : "NO");
    }
  }
}
