#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
inline int gi() {
  char c = getchar();
  bool f = 1;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') c = getchar(), f = 0;
  int sum = 0;
  while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
  return f ? sum : -sum;
}
int n, m, N, tp[maxn], sl[maxn], sr[maxn], *it[maxn << 1];
vector<int> vec[maxn << 2];
int fa[maxn], L[maxn], R[maxn];
int find(int x) { return fa[x] == x ? fa[x] : fa[x] = find(fa[x]); }
void modify(int s, int l, int r, int p, int t) {
  if (!vec[s].empty()) {
    for (int x : vec[s]) {
      x = find(x);
      L[t] = min(L[t], L[x]);
      R[t] = max(R[t], R[x]);
      fa[x] = t;
    }
    vec[s].clear();
    vec[s].push_back(t);
  }
  if (l == r) return;
  if (p <= ((l + r) >> 1))
    modify((s << 1), l, ((l + r) >> 1), p, t);
  else
    modify((s << 1 | 1), ((l + r) >> 1) + 1, r, p, t);
}
void insert(int s, int l, int r, int ql, int qr, int t) {
  if (ql <= l && r <= qr) return vec[s].push_back(t);
  if (ql <= ((l + r) >> 1)) insert((s << 1), l, ((l + r) >> 1), ql, qr, t);
  if (qr >= ((l + r) >> 1) + 1)
    insert((s << 1 | 1), ((l + r) >> 1) + 1, r, ql, qr, t);
}
int main() {
  n = gi();
  for (int i = 1; i <= n; ++i) {
    tp[i] = gi(), sl[i] = gi(), sr[i] = gi();
    if (tp[i] == 1) it[++m] = &sl[i], it[++m] = &sr[i];
  }
  sort(it + 1, it + m + 1, [](int *a, int *b) { return *a < *b; });
  for (int i = N = 1, lst = *it[1]; i <= m; ++i)
    if (*it[i] != lst)
      lst = *it[i], *it[i] = ++N;
    else
      *it[i] = N;
  for (int i = 1, j = 0; i <= n; ++i) {
    if (tp[i] == 1) {
      ++j;
      fa[j] = j;
      L[j] = sl[i];
      R[j] = sr[i];
      modify(1, 1, N, sl[i], j);
      modify(1, 1, N, sr[i], j);
      if (sl[i] + 1 <= sr[i] - 1) insert(1, 1, N, sl[i] + 1, sr[i] - 1, j);
    } else {
      int x = find(sl[i]), y = find(sr[i]);
      puts(x == y || (L[y] < L[x] && L[x] < R[y]) ||
                   (L[y] < R[x] && R[x] < R[y])
               ? "YES"
               : "NO");
    }
  }
  return 0;
}
