#include <bits/stdc++.h>
using namespace std;
int n, N, NN;
int fa[200010], rnk[200010];
set<int> s;
map<int, int> H;
struct query {
  int opt, l, r;
} q[200010];
inline int read() {
  int c = getchar(), temp = 0, f = 1;
  while ((c < 48 || c > 57) && c != '-') c = getchar();
  if (c == '-') {
    f = -1;
    c = getchar();
  }
  while (c > 47 && c < 58) {
    temp = temp * 10 + c - 48;
    c = getchar();
  }
  return temp * f;
}
inline int find(int x) { return fa[x] = x == fa[x] ? x : find(fa[x]); }
inline void unio(int x, int y) {
  int fx = find(x), fy = find(y);
  if (rnk[fx] < rnk[fy])
    fa[fx] = fy;
  else {
    fa[fy] = fx;
    if (rnk[fx] == rnk[fy]) rnk[fx]++;
  }
}
struct Seg11 {
  int l, r;
} Seg[200010];
struct Numl {
  int r, bel;
  inline Numl() : r(0), bel(0) {}
  inline Numl(const int& x, const int& y) : r(x), bel(y) {}
  inline friend bool operator<(const Numl& a, const Numl& b) {
    return a.r > b.r || a.r == b.r && a.bel < b.bel;
  }
  inline friend bool operator==(const Numl& a, const Numl& b) {
    return a.r == b.r && a.bel == b.bel;
  }
};
struct Numr {
  int l, bel;
  inline Numr() : l(0), bel(0) {}
  inline Numr(const int& x, const int& y) : l(x), bel(y) {}
  inline friend bool operator<(const Numr& a, const Numr& b) {
    return a.l < b.l || a.l == b.l && a.bel < b.bel;
  }
  inline friend bool operator==(const Numr& a, const Numr& b) {
    return a.l == b.l && a.bel == b.bel;
  }
};
multiset<Numl> sl[200010];
multiset<Numr> sr[200010];
struct seg_tree {
  int l, r;
  int mi, ma;
  int posmi, posma;
  int belmi, belma;
} seg[800010];
inline void build(int p, int l, int r) {
  seg[p].l = l;
  seg[p].r = r;
  seg[p].mi = N + 1;
  seg[p].ma = -1;
  if (l == r) return;
  int mid = (seg[p].l + seg[p].r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
}
inline void modifyMa(int p, int pos, Numl val, int opt) {
  if (seg[p].l == seg[p].r) {
    if (opt == -1) {
      sl[pos].erase(sl[pos].find(val));
      if (sl[pos].empty()) {
        seg[p].ma = -1;
        seg[p].posma = -1;
        seg[p].belma = -1;
      } else {
        seg[p].ma = sl[pos].begin()->r;
        seg[p].posma = pos;
        seg[p].belma = sl[pos].begin()->bel;
      }
    } else {
      sl[pos].insert(val);
      seg[p].ma = sl[pos].begin()->r;
      seg[p].posma = pos;
      seg[p].belma = sl[pos].begin()->bel;
    }
    return;
  }
  int mid = (seg[p].l + seg[p].r) >> 1;
  if (pos <= mid)
    modifyMa(p << 1, pos, val, opt);
  else
    modifyMa(p << 1 | 1, pos, val, opt);
  seg[p].ma = max(seg[p << 1].ma, seg[p << 1 | 1].ma);
  if (seg[p << 1].ma == seg[p].ma) {
    seg[p].posma = seg[p << 1].posma;
    seg[p].belma = seg[p << 1].belma;
  } else {
    seg[p].posma = seg[p << 1 | 1].posma;
    seg[p].belma = seg[p << 1 | 1].belma;
  }
}
inline void modifyMi(int p, int pos, Numr val, int opt) {
  if (seg[p].l == seg[p].r) {
    if (opt == -1) {
      sr[pos].erase(sr[pos].find(val));
      if (sr[pos].empty()) {
        seg[p].mi = N + 1;
        seg[p].posmi = -1;
        seg[p].belmi = -1;
      } else {
        seg[p].mi = sr[pos].begin()->l;
        seg[p].posmi = pos;
        seg[p].belmi = sr[pos].begin()->bel;
      }
    } else {
      sr[pos].insert(val);
      seg[p].mi = sr[pos].begin()->l;
      seg[p].posmi = pos;
      seg[p].belmi = sr[pos].begin()->bel;
    }
    return;
  }
  int mid = (seg[p].l + seg[p].r) >> 1;
  if (pos <= mid)
    modifyMi(p << 1, pos, val, opt);
  else
    modifyMi(p << 1 | 1, pos, val, opt);
  seg[p].mi = min(seg[p << 1].mi, seg[p << 1 | 1].mi);
  if (seg[p << 1].mi == seg[p].mi) {
    seg[p].posmi = seg[p << 1].posmi;
    seg[p].belmi = seg[p << 1].belmi;
  } else {
    seg[p].posmi = seg[p << 1 | 1].posmi;
    seg[p].belmi = seg[p << 1 | 1].belmi;
  }
}
inline pair<int, Numl> queryMa(int p, int l, int r) {
  if (seg[p].ma == -1) return make_pair(-1, Numl(-1, -1));
  if (l <= seg[p].l && seg[p].r <= r)
    return make_pair(seg[p].posma, Numl(seg[p].ma, seg[p].belma));
  int mid = (seg[p].l + seg[p].r) >> 1;
  if (r <= mid)
    return queryMa(p << 1, l, r);
  else if (l > mid)
    return queryMa(p << 1 | 1, l, r);
  else {
    pair<int, Numl> temp1 = queryMa(p << 1, l, mid);
    pair<int, Numl> temp2 = queryMa(p << 1 | 1, mid + 1, r);
    if (temp1.second.r < temp2.second.r)
      return temp2;
    else
      return temp1;
  }
}
inline pair<int, Numr> queryMi(int p, int l, int r) {
  if (seg[p].mi == N + 1) return make_pair(-1, Numr(N + 1, -1));
  if (l <= seg[p].l && seg[p].r <= r)
    return make_pair(seg[p].posmi, Numr(seg[p].mi, seg[p].belmi));
  int mid = (seg[p].l + seg[p].r) >> 1;
  if (r <= mid)
    return queryMi(p << 1, l, r);
  else if (l > mid)
    return queryMi(p << 1 | 1, l, r);
  else {
    pair<int, Numr> temp1 = queryMi(p << 1, l, mid);
    pair<int, Numr> temp2 = queryMi(p << 1 | 1, mid + 1, r);
    if (temp1.second.l > temp2.second.l)
      return temp2;
    else
      return temp1;
  }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    q[i].opt = read();
    q[i].l = read();
    q[i].r = read();
    if (q[i].opt == 1) {
      s.insert(q[i].l);
      s.insert(q[i].r);
    }
  }
  for (set<int>::iterator it = s.begin(); it != s.end(); it++) H[*it] = ++N;
  build(1, 1, N);
  for (int i = 1; i <= n; i++) {
    if (q[i].opt == 1) {
      ++NN;
      fa[NN] = NN;
      int l = H[q[i].l], r = H[q[i].r];
      int L = l, R = r;
      if (l > 1)
        while (true) {
          pair<int, Numl> temp = queryMa(1, 1, l - 1);
          if (temp.second.r <= r) break;
          L = min(L, temp.first);
          R = max(R, temp.second.r);
          unio(NN, temp.second.bel);
          modifyMa(1, temp.first, temp.second, -1);
          modifyMi(1, temp.second.r, Numr(temp.first, temp.second.bel), -1);
        }
      if (l + 1 < r) {
        while (true) {
          pair<int, Numl> temp = queryMa(1, l + 1, r - 1);
          if (temp.second.r <= r) break;
          L = min(L, temp.first);
          R = max(R, temp.second.r);
          unio(NN, temp.second.bel);
          modifyMa(1, temp.first, temp.second, -1);
          modifyMi(1, temp.second.r, Numr(temp.first, temp.second.bel), -1);
        }
        while (true) {
          pair<int, Numr> temp = queryMi(1, l + 1, r - 1);
          if (temp.second.l >= l) break;
          L = min(L, temp.second.l);
          R = max(R, temp.first);
          unio(NN, temp.second.bel);
          modifyMa(1, temp.second.l, Numl(temp.first, temp.second.bel), -1);
          modifyMi(1, temp.first, temp.second, -1);
        }
      }
      int fN = find(NN);
      Seg[fN].l = L;
      Seg[fN].r = R;
      modifyMa(1, Seg[fN].l, Numl(Seg[fN].r, fN), 1);
      modifyMi(1, Seg[fN].r, Numr(Seg[fN].l, fN), 1);
    } else {
      int fx = find(q[i].l), fy = find(q[i].r);
      if (fx == fy || (Seg[fy].l < Seg[fx].l && Seg[fx].l < Seg[fy].r) ||
          (Seg[fy].l < Seg[fx].r && Seg[fx].r < Seg[fy].r))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
