#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long mod) {
  if (y < 0) return power(power(x, mod - 2, mod), -y, mod);
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    y >>= 1;
    x = x * x % mod;
  }
  return res;
}
const int nn = 400010;
vector<int> e[nn * 4];
int n, cnt, p[nn], k[nn], x[nn], y[nn], f[nn], L[nn], R[nn];
int find(int x) { return f[x] == x ? x : (f[x] = find(f[x])); }
void merge(int x, int y) {
  int fx = find(x), fy = find(y);
  if (fx == fy) return;
  f[fy] = fx;
  L[fx] = min(L[fx], L[fy]);
  R[fx] = max(R[fx], R[fy]);
}
void gao(int p, int l, int r, int x, int id) {
  for (int i = (int)0; i <= (int)((int)(e[p].size())) - 1; ++i)
    merge(e[p][i], id);
  e[p].clear();
  if (l == r) return;
  int mid = l + r >> 1, lc = p << 1, rc = lc + 1;
  if (x <= mid)
    gao(lc, l, mid, x, id);
  else
    gao(rc, mid + 1, r, x, id);
}
void insert(int p, int l, int r, int x, int y, int id) {
  if (x > y || r < x || y < l) return;
  if (x <= l && r <= y) {
    e[p].push_back(id);
    return;
  }
  int mid = l + r >> 1, lc = p << 1, rc = lc + 1;
  insert(lc, l, mid, x, y, id);
  insert(rc, mid + 1, r, x, y, id);
}
int main() {
  scanf("%d", &n);
  for (int i = (int)1; i <= (int)n; ++i) {
    scanf("%d%d%d", &k[i], &x[i], &y[i]);
    if (k[i] == 2) continue;
    p[++cnt] = x[i];
    p[++cnt] = y[i];
    p[++cnt] = x[i] + 1;
    p[++cnt] = y[i] - 1;
  }
  sort(p + 1, p + 1 + cnt);
  cnt = unique(p + 1, p + 1 + cnt) - p - 1;
  for (int i = (int)1; i <= (int)n; ++i) f[i] = i;
  int ti = 0;
  for (int i = (int)1; i <= (int)n; ++i) {
    if (k[i] == 1) {
      x[i] = lower_bound(p + 1, p + 1 + cnt, x[i]) - p;
      y[i] = lower_bound(p + 1, p + 1 + cnt, y[i]) - p;
      ti++;
      L[ti] = x[i];
      R[ti] = y[i];
      gao(1, 1, cnt, x[i], ti);
      gao(1, 1, cnt, y[i], ti);
      insert(1, 1, cnt, L[find(ti)] + 1, R[find(ti)] - 1, ti);
    } else {
      int fx = find(x[i]), fy = find(y[i]);
      if (fx == fy || L[fy] <= L[fx] && R[fx] <= R[fy])
        puts("YES");
      else
        puts("NO");
    }
  }
  return 0;
}
