#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 3;
const int infint = (int)2e9;
const long long inf = (long long)2e18;
vector<int> seg[4 * MAXN], vec;
int n, t[MAXN], a[MAXN], b[MAXN], pos[MAXN], par[MAXN], sz, l[MAXN], r[MAXN];
int get_par(int u) { return par[u] < 0 ? u : par[u] = get_par(par[u]); }
void merge(int u, int v) {
  u = get_par(u);
  v = get_par(v);
  if (u == v) return;
  if (par[u] > par[v]) swap(par[u], par[v]);
  par[v] = u;
  l[u] = min(l[u], l[v]);
  r[u] = max(r[u], r[v]);
}
void update(int u, int x, int id = 1, int st = 0, int en = vec.size() << 1) {
  for (auto v : seg[id]) merge(u, v);
  seg[id].clear();
  if (en - st == 1) return;
  int mid = st + en >> 1;
  if (x < mid)
    update(u, x, id << 1, st, mid);
  else
    update(u, x, id << 1 | 1, mid, en);
}
void add(int u, int id = 1, int st = 0, int en = vec.size() << 1) {
  if (r[u] <= st || en <= l[u] + 1) return;
  if (l[u] + 1 <= st && en <= r[u]) return seg[id].push_back(u);
  int mid = st + en >> 1;
  add(u, id << 1, st, mid);
  add(u, id << 1 | 1, mid, en);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[i] >> a[i] >> b[i];
    if (t[i] == 1) {
      par[i] = -1;
      vec.push_back(a[i]);
      vec.push_back(b[i]);
    }
  }
  sort(vec.begin(), vec.end());
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  sz = vec.size();
  for (int i = 0, j = 0; i < n; i++)
    if (t[i] == 1) {
      l[i] = a[i] = lower_bound(vec.begin(), vec.end(), a[i]) - vec.begin();
      r[i] = b[i] = lower_bound(vec.begin(), vec.end(), b[i]) - vec.begin();
      update(i, a[i]), update(i, b[i]), add(pos[++j] = i);
    } else {
      int u = get_par(pos[a[i]]), v = get_par(pos[b[i]]);
      cout << ((l[v] <= l[u] && r[u] <= r[v]) ? "YES" : "NO") << "\n";
    }
}
