#include <bits/stdc++.h>
using namespace std;
int Read() {
  char c;
  while (c = getchar(), (c != '-') && (c < '0' || c > '9'))
    ;
  bool neg = (c == '-');
  int ret = (neg ? 0 : c - 48);
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + c - 48;
  return neg ? -ret : ret;
}
const int MAXN = 100005, INF = 1e9;
struct node {
  int l, r;
  vector<int> a;
} t[MAXN * 35];
pair<int, int> a[MAXN];
int N, M, root, cnt, fa[MAXN];
int Findset(int x) { return fa[x] == x ? x : fa[x] = Findset(fa[x]), fa[x]; }
void Merge(int id, int l, int r, int x) {
  if (!id) return;
  for (int i = 0; i <= (int)t[id].a.size() - 1; i++) {
    int y = t[id].a[i], z = Findset(y);
    a[M].first = min(a[M].first, a[z].first),
    a[M].second = max(a[M].second, a[z].second), fa[z] = M;
  }
  t[id].a.clear();
  if (l == r) return;
  int mid = (l >> 1) + (r >> 1) + (l & r & 1);
  if (x <= mid)
    Merge(t[id].l, l, mid, x);
  else
    Merge(t[id].r, mid + 1, r, x);
}
void Insert(int &id, int l, int r, int gl, int gr) {
  if (!id) id = ++cnt;
  if (gl <= l && r <= gr) {
    t[id].a.push_back(M);
    return;
  }
  int mid = (l >> 1) + (r >> 1) + (l & r & 1);
  if (gl <= mid) Insert(t[id].l, l, mid, gl, gr);
  if (gr > mid) Insert(t[id].r, mid + 1, r, gl, gr);
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    int tp = Read(), x = Read() + INF, y = Read() + INF;
    if (tp == 1) {
      a[++M] = make_pair(x, y), fa[M] = M;
      Merge(root, 0, 2 * INF, x);
      Merge(root, 0, 2 * INF, y);
      if (a[M].first + 1 < a[M].second)
        Insert(root, 0, 2 * INF, a[M].first + 1, a[M].second - 1);
    } else {
      x = Findset(x - INF), y = Findset(y - INF);
      puts(x == y || ((a[x].first > a[y].first && a[x].first < a[y].second) ||
                      (a[x].second > a[y].first && a[x].second < a[y].second))
               ? "YES"
               : "NO");
    }
  }
  return 0;
}
