#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int rd() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
vector<int> sb[N << 3], wk;
int ff[N], ml[N], mr[N], bx[N << 1], tx;
int findf(int x) { return ff[x] == x ? x : ff[x] = findf(ff[x]); }
int n, q, qq[N][3];
void ptt(int o, int l, int r, int ll, int rr, int x) {
  if (ll > rr) return;
  if (ll <= l && r <= rr) {
    sb[o].push_back(x);
    return;
  }
  int mid = (l + r) >> 1;
  if (ll <= mid) ptt(o << 1, l, mid, ll, rr, x);
  if (rr > mid) ptt(o << 1 | 1, mid + 1, r, ll, rr, x);
}
void qrr(int o, int l, int r, int lx) {
  int nn = sb[o].size();
  for (int i = 0; i < nn; ++i) {
    int x = sb[o][i];
    if (findf(x) != x)
      swap(sb[o][i], sb[o][nn - 1]), sb[o].pop_back(), --nn, --i;
    else
      wk.push_back(x);
  }
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (lx <= mid)
    qrr(o << 1, l, mid, lx);
  else
    qrr(o << 1 | 1, mid + 1, r, lx);
}
int main() {
  q = rd();
  for (int i = 1; i <= q; ++i) {
    for (int j = 0; j <= 2; ++j) qq[i][j] = rd();
    if (qq[i][0] == 1) bx[++tx] = qq[i][1], bx[++tx] = qq[i][2];
  }
  sort(bx + 1, bx + tx + 1), tx = unique(bx + 1, bx + tx + 1) - bx - 1;
  for (int i = 1; i <= q; ++i)
    if (qq[i][0] == 1) {
      qq[i][1] = lower_bound(bx + 1, bx + tx + 1, qq[i][1]) - bx;
      qq[i][2] = lower_bound(bx + 1, bx + tx + 1, qq[i][2]) - bx;
    }
  for (int i = 1; i <= q; ++i) {
    if (qq[i][0] == 1) {
      ++n, ff[n] = n, ml[n] = qq[i][1], mr[n] = qq[i][2];
      wk.clear();
      qrr(1, 1, tx, ml[n]), qrr(1, 1, tx, mr[n]);
      int nn = wk.size();
      for (int h = 0; h < nn; ++h) {
        int x = wk[h];
        if (findf(x) != x) continue;
        ff[x] = n, ml[n] = min(ml[n], ml[x]), mr[n] = max(mr[n], mr[x]);
      }
      ptt(1, 1, tx, ml[n] + 1, mr[n] - 1, n);
    } else {
      int x = findf(qq[i][1]), y = findf(qq[i][2]);
      bool ok = x == y;
      ok |= (!(ml[x] == ml[y] && mr[x] == mr[y]) &&
             ((ml[x] > ml[y] && ml[x] < mr[y]) ||
              (mr[x] > ml[y] && mr[x] < mr[y])));
      puts(ok ? "YES" : "NO");
    }
  }
  return 0;
}
