#include <bits/stdc++.h>
using namespace std;
long long ksm(long long a, long long b) {
  if (!b) return 1;
  long long ns = ksm(a, b >> 1);
  ns = ns * ns % 998244353;
  if (b & 1) ns = ns * a % 998244353;
  return ns;
}
int t, tp[300010], a[300010], b[300010];
int fa[300010], vis[300010];
pair<int, int> seg[300010];
int gfa(int a) {
  if (fa[a] == a) return a;
  return fa[a] = gfa(fa[a]);
}
struct ST {
  int l, r;
  ST *ch[2];
  vector<int> tr;
} p[300010 << 1], *root;
int stcnt = 0;
void bdtree(ST *a, int l, int r) {
  a->l = l, a->r = r;
  if (l == r) return;
  int mid = (l + r) >> 1;
  a->ch[0] = &p[stcnt++], a->ch[1] = &p[stcnt++];
  bdtree(a->ch[0], l, mid), bdtree(a->ch[1], mid + 1, r);
}
void ch(ST *a, int l, int r, int id) {
  if (l > r) return;
  if (a->l == l && a->r == r) {
    a->tr.push_back(id);
    return;
  }
  int mid = (a->l + a->r) >> 1;
  if (r <= mid)
    ch(a->ch[0], l, r, id);
  else if (l > mid)
    ch(a->ch[1], l, r, id);
  else
    ch(a->ch[0], l, mid, id), ch(a->ch[1], mid + 1, r, id);
}
vector<int> res;
void q(ST *a, int pl) {
  res.insert(res.end(), a->tr.begin(), a->tr.end());
  a->tr.clear();
  if (a->l == a->r) return;
  int mid = (a->l + a->r) >> 1;
  if (pl <= mid)
    q(a->ch[0], pl);
  else
    q(a->ch[1], pl);
}
pair<int, int> re[300010];
int id[300010];
int idcnt = 0, ncnt = 0;
int main() {
  for (int i = 0; i < 300010; i++) fa[i] = i;
  int n;
  cin >> n;
  vector<int> st;
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d", &tp[i], &a[i], &b[i]), st.push_back(a[i]),
        st.push_back(b[i]);
  sort(st.begin(), st.end());
  for (int i = 1; i <= n; i++)
    if (tp[i] == 1)
      a[i] = lower_bound(st.begin(), st.end(), a[i]) - st.begin(),
      b[i] = lower_bound(st.begin(), st.end(), b[i]) - st.begin();
  root = &p[stcnt++];
  bdtree(root, 0, st.size());
  for (int i = 1; i <= n; i++) {
    if (tp[i] == 2) {
      int ans = 0;
      int ns = gfa(id[b[i]]);
      if (seg[ns].first < re[a[i]].first && seg[ns].second > re[a[i]].first)
        ans = 1;
      if (seg[ns].first < re[a[i]].second && seg[ns].second > re[a[i]].second)
        ans = 1;
      if (ans)
        printf("YES\n");
      else
        printf("NO\n");
    } else {
      re[++ncnt] = make_pair(a[i], b[i]);
      id[ncnt] = ++idcnt;
      seg[idcnt] = make_pair(a[i], b[i]);
      res.clear();
      q(root, a[i]), q(root, b[i]);
      res.push_back(idcnt);
      ++idcnt;
      int nl = 1e9, nr = -1e9;
      for (int i = 0; i < res.size(); i++) {
        int nid = res[i];
        if (vis[nid]) continue;
        vis[nid] = 1;
        nl = min(nl, seg[nid].first), nr = max(nr, seg[nid].second);
        fa[nid] = idcnt;
      }
      seg[idcnt] = make_pair(nl, nr);
      ch(root, nl + 1, nr - 1, idcnt);
    }
  }
  return 0;
}
