#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma G++ optimize("O2")
using namespace std;
const int N = 222222;
const int M = 888888;
const int MOD = 1e9 + 7;
const int intINF = 1e9;
const long long llINF = 2e18;
const double pi = acos(-1.0);
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double eps = 1e-10;
int read() {
  int v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
long long readll() {
  long long v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
unsigned long long readull() {
  long long v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
void predo() {}
struct node {
  int op, l, r;
} a[N];
int fa[N], L[N], R[N], b[N], n, q, cnt;
vector<int> V[N << 2];
int dsu(int k) {
  if (fa[k] != k) fa[k] = dsu(fa[k]);
  return fa[k];
}
void update(int l, int r, int x, int cnt, int p) {
  if (!V[p].empty()) {
    for (auto t : V[p]) {
      t = dsu(t);
      fa[t] = cnt;
      L[cnt] = min(L[cnt], L[t]);
      R[cnt] = max(R[cnt], R[t]);
    }
    V[p].clear();
    V[p].push_back(cnt);
  }
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (x <= mid)
    update(l, mid, x, cnt, p << 1);
  else
    update(mid + 1, r, x, cnt, p << 1 | 1);
}
void ins(int l, int r, int x, int y, int cnt, int p) {
  if (x <= l && r <= y) {
    V[p].push_back(cnt);
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid) ins(l, mid, x, y, cnt, p << 1);
  if (y > mid) ins(mid + 1, r, x, y, cnt, p << 1 | 1);
}
void init() {
  q = read();
  for (int i = (int)1; i <= (int)q; i++) {
    a[i].op = read(), a[i].l = read(), a[i].r = read();
    if (a[i].op == 1) {
      b[++n] = a[i].l;
      b[++n] = a[i].r;
    }
  }
}
void solve() {
  sort(b + 1, b + n + 1);
  n = unique(b + 1, b + n + 1) - b - 1;
  for (int i = (int)1; i <= (int)q; i++) {
    if (a[i].op == 1) {
      a[i].l = lower_bound(b + 1, b + n + 1, a[i].l) - b;
      a[i].r = lower_bound(b + 1, b + n + 1, a[i].r) - b;
      cnt++;
      fa[cnt] = cnt;
      L[cnt] = a[i].l;
      R[cnt] = a[i].r;
      update(1, n, a[i].l, cnt, 1);
      update(1, n, a[i].r, cnt, 1);
      if (a[i].l + 1 <= a[i].r - 1) ins(1, n, a[i].l + 1, a[i].r - 1, cnt, 1);
    }
    if (a[i].op == 2) {
      int p = dsu(a[i].l), q = dsu(a[i].r);
      int flag = 0;
      if (p == q) flag = 1;
      if (L[q] < L[p] && L[p] < R[q]) flag = 1;
      if (L[q] < R[p] && R[p] < R[q]) flag = 1;
      if (flag)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}
int main() {
  predo();
  int cas = 1;
  while (cas--) {
    init();
    solve();
  }
  return 0;
}
