#include <bits/stdc++.h>
using namespace std;
struct ww {
  int x, y;
} a[100010], b[100010];
struct tree {
  int l, r;
  vector<int> a;
} tr[100010 * 40];
int i, j, k, n, m, ty, x, y, t, root;
int f[100010];
int get(int x) { return f[x] == x ? x : f[x] = get(f[x]); }
inline void Get(int x, int y) {
  a[x].x = min(a[x].x, a[y].x);
  a[x].y = max(a[x].y, a[y].y);
}
void cal(int q, int x, int y, int k) {
  if (!q) return;
  int i;
  for (i = 0; i < tr[q].a.size(); i++) {
    int A = tr[q].a[i];
    Get(m, get(A));
    f[get(A)] = m;
  }
  tr[q].a.clear();
  if (x == y) return;
  int mid = (x + y) / 2;
  if (mid == y) mid--;
  if (k <= mid)
    cal(tr[q].l, x, mid, k);
  else
    cal(tr[q].r, mid + 1, y, k);
}
void into(int &q, int x, int y, int l, int r) {
  if (!q) q = ++t;
  if (l <= x && y <= r) {
    tr[q].a.push_back(m);
    return;
  }
  int mid = (x + y) / 2;
  if (mid == y) mid--;
  if (l <= mid) into(tr[q].l, x, mid, l, r);
  if (mid < r) into(tr[q].r, mid + 1, y, l, r);
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d%d", &ty, &x, &y);
    if (ty == 1) {
      a[++m] = b[m] = (ww){x, y};
      f[m] = m;
      cal(root, -1000000000, 1000000000, x);
      cal(root, -1000000000, 1000000000, y);
      if (a[m].x + 1 < a[m].y)
        into(root, -1000000000, 1000000000, a[m].x + 1, a[m].y - 1);
    } else {
      y = get(y);
      if (get(x) == y || b[x].x > a[y].x && b[x].x < a[y].y ||
          b[x].y > a[y].x && b[x].y < a[y].y)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
