#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ '0');
    ch = getchar();
  }
  return f ? x : -x;
}
int n, b[200005], bt, fa[100005], cnt, edgel[100005], edger[100005],
    ord[100005];
struct query {
  int op, l, r;
} q[100005];
inline int getf(int x) { return fa[x] = fa[x] == x ? x : getf(fa[x]); }
inline void chkmin(int& x, int y) { x = x < y ? x : y; }
inline void chkmax(int& x, int y) { x = x > y ? x : y; }
vector<int> tr[800005];
void modify(int p, int l, int r, int pos, int id) {
  if ((int)(tr[p]).size()) {
    for (int u : tr[p]) {
      int x = getf(u);
      fa[x] = id;
      chkmin(edgel[id], edgel[x]);
      chkmax(edger[id], edger[x]);
    }
    tr[p].clear(), tr[p].push_back(id);
  }
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (pos <= mid)
    modify(p << 1, l, mid, pos, id);
  else
    modify(p << 1 | 1, mid + 1, r, pos, id);
}
void add(int p, int l, int r, int L, int R, int id) {
  if (L > R) return;
  if (L <= l && r <= R) return tr[p].push_back(id), void();
  int mid = (l + r) >> 1;
  if (L <= mid) add(p << 1, l, mid, L, R, id);
  if (mid < R) add(p << 1 | 1, mid + 1, r, L, R, id);
}
int main() {
  n = read();
  for (int t = (1), _ed = (n); t <= _ed; ++t) {
    q[t] = (query){read(), read(), read()};
    if (q[t].op == 1) b[++bt] = q[t].l, b[++bt] = q[t].r;
  }
  sort(b + 1, b + bt + 1), bt = unique(b + 1, b + bt + 1) - b - 1;
  for (int i = (1), _ed = (n); i <= _ed; ++i)
    if (q[i].op == 1)
      q[i].l = lower_bound(b + 1, b + bt + 1, q[i].l) - b,
      q[i].r = lower_bound(b + 1, b + bt + 1, q[i].r) - b;
  for (int t = (1), _ed = (n); t <= _ed; ++t) {
    if (q[t].op == 1) {
      int l = q[t].l, r = q[t].r;
      ++cnt, edgel[cnt] = l, edger[cnt] = r, fa[cnt] = cnt, ord[cnt] = t;
      modify(1, 1, bt, l, cnt);
      modify(1, 1, bt, r, cnt);
      add(1, 1, bt, edgel[cnt] + 1, edger[cnt] - 1, cnt);
    } else {
      int x = q[t].l, y = getf(q[t].r);
      int p = ord[x];
      int flg = (edgel[y] < q[p].l && q[p].l < edger[y]) ||
                (edgel[y] < q[p].r && q[p].r < edger[y]);
      if (flg || getf(x) == y)
        puts("YES");
      else
        puts("NO");
    }
  }
  return 0;
}
