#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int Pow(int a, int b, int md, int ans = 1) {
  for (; b; b >>= 1, a = a * a % md)
    if (b & 1) ans = ans * a % md;
  return ans;
}
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;
vector<int> seg[MAXN << 2], compress, vec;
int L[MAXN], R[MAXN], ql[MAXN], qr[MAXN], qt[MAXN], P[MAXN], q;
int Find(int v) { return P[v] == -1 ? v : P[v] = Find(P[v]); }
void Union(int u, int v) {
  u = Find(u), v = Find(v);
  if (u == v) return;
  P[u] = v;
  assert(L[u] && R[u] && L[v] && R[v]);
  L[v] = min(L[v], L[u]);
  R[v] = max(R[v], R[u]);
}
void relax(int id) {
  while ((int)seg[id].size() > 1) seg[id].erase(seg[id].begin());
}
void update(int Ql, int Qr, int d, int id = 1, int l = 1,
            int r = (int)compress.size() + 1) {
  if (Qr <= l || r <= Ql || Ql >= Qr) return;
  if (Ql <= l && r <= Qr) {
    seg[id].push_back(d);
    return;
  }
  int mid = (l + r) >> 1;
  update(Ql, Qr, d, id << 1, l, mid);
  update(Ql, Qr, d, id << 1 | 1, mid, r);
}
void modify(int pos, int d, int id = 1, int l = 1,
            int r = (int)compress.size() + 1) {
  assert(pos < r && pos >= l);
  for (int X : seg[id]) Union(d, X);
  relax(id);
  if (r - l == 1) return;
  int mid = (l + r) >> 1;
  if (pos < mid)
    modify(pos, d, id << 1, l, mid);
  else
    modify(pos, d, id << 1 | 1, mid, r);
}
int main() {
  scanf("%d", &q);
  fill(P, P + MAXN, -1);
  for (int i = 1; i <= q; i++) {
    scanf("%d%d%d", &qt[i], &ql[i], &qr[i]);
    if (qt[i] == 1) compress.push_back(ql[i]), compress.push_back(qr[i]);
  }
  sort((compress).begin(), (compress).end());
  compress.resize(unique((compress).begin(), (compress).end()) -
                  compress.begin());
  for (int i = 1; i <= q; i++) {
    if (qt[i] == 2) continue;
    ql[i] = lower_bound((compress).begin(), (compress).end(), ql[i]) -
            compress.begin() + 1;
    qr[i] = lower_bound((compress).begin(), (compress).end(), qr[i]) -
            compress.begin() + 1;
    L[i] = ql[i], R[i] = qr[i];
  }
  for (int i = 1; i <= q; i++) {
    if (qt[i] == 1) {
      modify(ql[i], i);
      modify(qr[i], i);
      update(ql[i] + 1, qr[i], i);
      vec.push_back(i);
    } else {
      int v = Find(vec[ql[i] - 1]), u = Find(vec[qr[i] - 1]);
      if (u == v || (L[u] < L[v] && L[v] < R[u]) ||
          (L[u] < R[v] && R[v] < R[u]))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
