#include <bits/stdc++.h>
using namespace std;
const int mxn = 1 << 18;
int t[mxn], x[mxn], y[mxn];
struct UF {
  int fa[mxn], sz[mxn], l[mxn], r[mxn];
  UF() {
    for (int i = 0; i < (int)(mxn); ++i) fa[i] = i, sz[i] = 1;
  }
  int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
  void merge(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (sz[x] < sz[y]) swap(x, y);
    fa[y] = x;
    sz[x] += sz[y];
    l[x] = min(l[x], l[y]);
    r[x] = max(r[x], r[y]);
  }
} uf;
struct SEG {
  vector<int> vec[mxn << 1];
  void upd(int l, int r, int i) {
    for (l += mxn, r += mxn; l < r; l >>= 1, r >>= 1) {
      if (l & 1) vec[l].push_back(i), ++l;
      if (r & 1) --r, vec[r].push_back(i);
    }
  }
  void conn(int p, int i) {
    for (p += mxn; p; p >>= 1)
      if (!vec[p].empty()) {
        for (int j = 0; j < (int)(vec[p].size()); ++j) uf.merge(vec[p][j], i);
        vec[p].clear();
        vec[p].push_back(i);
      }
  }
} seg;
int main() {
  int q;
  scanf("%d", &q);
  vector<int> v;
  for (int i = 0; i < (int)(q); ++i) {
    scanf("%d %d %d", &t[i], &x[i], &y[i]);
    if (t[i] == 1) v.push_back(x[i]), v.push_back(y[i]);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  vector<int> ids;
  for (int i = 0; i < (int)(q); ++i) {
    if (t[i] == 1) {
      int l = uf.l[i] = lower_bound(v.begin(), v.end(), x[i]) - v.begin();
      int r = uf.r[i] = lower_bound(v.begin(), v.end(), y[i]) - v.begin();
      seg.conn(l, i);
      seg.conn(r, i);
      seg.upd(l + 1, r, i);
      ids.push_back(i);
    } else {
      int u = uf.find(ids[x[i] - 1]), v = uf.find(ids[y[i] - 1]);
      puts(uf.l[v] <= uf.l[u] && uf.r[u] <= uf.r[v] ? "YES" : "NO");
    }
  }
  return 0;
}
