#include <bits/stdc++.h>
using namespace std;
const int Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
template <int siz>
struct UnionFind {
  int fa[siz + 5];
  void inline init() { memset(fa, -1, sizeof(fa)); }
  UnionFind() { init(); }
  int inline root(int x) { return fa[x] < 0 ? x : fa[x] = root(fa[x]); }
  bool inline conn(int a, int b) {
    a = root(a);
    b = root(b);
    if (a == b) return 0;
    return fa[b] += fa[a], fa[a] = b, 1;
  }
};
template <typename num>
struct Lissan {
  vector<num> lss;
  bool built;
  void inline clear() {
    lss.clear();
    built = 0;
  }
  void inline add(num x) { lss.push_back(x); }
  void inline build() {
    sort((lss).begin(), (lss).end());
    lss.erase(unique((lss).begin(), (lss).end()), lss.end());
    built = 1;
  }
  int inline size() {
    assert(built);
    return ((int)(lss).size());
  }
  int inline get(num x, int th = 0) {
    assert(built);
    return lower_bound((lss).begin(), (lss).end(), x) - lss.begin() + th;
  }
};
UnionFind<1 << 17> uf;
int n, m;
Lissan<int> lss;
int mode[1 << 17], x[1 << 17], y[1 << 17];
int id, nx[1 << 17], ny[1 << 17];
vector<int> vi[1 << 19];
void inline add(int l, int r, int x, int now = 1, int nl = 0, int nr = m) {
  if (nl >= l && nr <= r) return void(vi[now].push_back(x));
  if (nl > r || nr < l) return;
  int m = (nl + nr) >> 1;
  add(l, r, x, now << 1, nl, m);
  add(l, r, x, now << 1 | 1, m + 1, nr);
}
void inline conn(int to, int x, int now = 1, int nl = 0, int nr = m) {
  while (((int)(vi[now]).size())) {
    int y = uf.root(vi[now].back());
    nx[x] = min(nx[x], nx[y]);
    ny[x] = max(ny[x], ny[y]);
    uf.conn(y, x);
    vi[now].pop_back();
  }
  if (nl == nr) return;
  int m = (nl + nr) >> 1;
  if (m >= to)
    conn(to, x, now << 1, nl, m);
  else
    conn(to, x, now << 1 | 1, m + 1, nr);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= (n); i++) {
    scanf("%d%d%d", mode + i, x + i, y + i);
    lss.add(x[i]);
    lss.add(y[i]);
  }
  lss.build();
  m = ((int)(lss).size());
  uf.init();
  for (int i = 1; i <= (n); i++)
    if (mode[i] == 1) x[i] = lss.get(x[i]), y[i] = lss.get(y[i]);
  for (int i = 1; i <= (n); i++) {
    if (mode[i] == 1) {
      nx[++id] = x[i], ny[id] = y[i];
      conn(x[i], id);
      conn(y[i], id);
      if (nx[id] < ny[id] - 1) add(nx[id] + 1, ny[id] - 1, id);
    } else {
      int ix = uf.root(x[i]), iy = uf.root(y[i]);
      if (ix == iy || (nx[iy] < nx[ix] && nx[ix] < ny[iy]) ||
          (nx[iy] < ny[ix] && ny[ix] < ny[iy])) {
        puts("YES");
      } else {
        puts("NO");
      }
    }
  }
  return 0;
}
