#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100005;
int n, N = 0;
int num[Maxn * 2];
int fa[Maxn], h[Maxn], lef[Maxn], rig[Maxn];
int st[Maxn], en[Maxn];
inline int get() {
  bool f = false;
  char ch;
  while (!isdigit(ch = getchar())) f |= ch == '-';
  int v = ch - 48;
  while (isdigit(ch = getchar())) v = v * 10 + ch - 48;
  return f ? -v : v;
}
int find(int x) { return fa[x] ? fa[x] = find(fa[x]) : x; }
inline void Union(int x, int y) {
  x = find(x);
  y = find(y);
  if (x != y) {
    if (h[x] >= h[y]) {
      fa[y] = x;
      h[x] += h[x] == h[y];
      lef[x] > lef[y] ? lef[x] = lef[y] : 0;
      rig[x] < rig[y] ? rig[x] = rig[y] : 0;
    } else {
      fa[x] = y;
      lef[y] > lef[x] ? lef[y] = lef[x] : 0;
      rig[y] < rig[x] ? rig[y] = rig[x] : 0;
    }
  }
}
struct node {
  vector<int> q;
  node *lc, *rc;
} po[Maxn * 4], *pn = po;
class Segment_Tree {
  node *root;
  vector<int>::iterator It;
  void build(node *&x, int l, int r) {
    x = ++pn;
    if (l == r) return;
    int mid = (l + r) >> 1;
    build(x->lc, l, mid);
    build(x->rc, mid + 1, r);
  }
  void query(node *x, int l, int r, int p, int i) {
    for (It = x->q.begin(); It != x->q.end(); ++It) Union(i, *It);
    x->q.clear();
    if (l == r) return;
    int mid = (l + r) >> 1;
    if (p <= mid)
      query(x->lc, l, mid, p, i);
    else
      query(x->rc, mid + 1, r, p, i);
  }
  void insert(node *x, int l, int r, int s, int t, int i) {
    if (s <= l && t >= r)
      x->q.push_back(i);
    else {
      int mid = (l + r) >> 1;
      if (s <= mid) insert(x->lc, l, mid, s, t, i);
      if (t > mid) insert(x->rc, mid + 1, r, s, t, i);
    }
  }

 public:
  void build() { build(root, 1, N); }
  void query(int p, int i) { query(root, 1, N, p, i); }
  void insert(int s, int t, int i) {
    if (s <= t) insert(root, 1, N, s, t, i);
    ;
  }
} tr;
struct task {
  int opx, x, y;
} q[Maxn];
void solve(task g) {
  int opx = g.opx, x = g.x, y = g.y;
  if (opx) {
    x = lower_bound(num + 1, num + N + 1, x) - num;
    y = lower_bound(num + 1, num + N + 1, y) - num;
    lef[opx] = x;
    rig[opx] = y;
    st[opx] = x;
    en[opx] = y;
    tr.query(x, opx);
    tr.query(y, opx);
    opx = find(opx);
    tr.insert(lef[opx] + 1, rig[opx] - 1, opx);
  } else {
    y = find(y);
    if (find(x) == y || (lef[y] < st[x] && st[x] < rig[y]) ||
        (lef[y] < en[x] && en[x] < rig[y]))
      puts("YES");
    else
      puts("NO");
  }
}
int main() {
  n = get();
  for (int i = 1, tot = 0; i <= n; i++) {
    q[i].opx = get() == 1 ? ++tot : 0;
    q[i].x = get();
    q[i].y = get();
    if (q[i].opx) num[++N] = q[i].x, num[++N] = q[i].y;
  }
  sort(num + 1, num + N + 1);
  N = unique(num + 1, num + N + 1) - num - 1;
  tr.build();
  for (int i = 1; i <= n; i++) solve(q[i]);
  return 0;
}
