#include <bits/stdc++.h>
using namespace std;
vector<int> s[200050 * 4];
pair<int, int> li[200050];
int n, m, st, qu[200050][3], fa[200050], sg[200050];
inline int Read() {
  int x = 0;
  char y;
  bool z = 0;
  do y = getchar(), z |= y == '-';
  while (y < '0' || y > '9');
  do x = x * 10 + y - '0', y = getchar();
  while (y >= '0' && y <= '9');
  return z ? -x : x;
}
void Pretreat() {
  int now = 0;
  for (int i = 1; i <= n; i++)
    if (qu[i][0] == 1)
      li[++now].first = qu[i][1], li[now].second = i,
      li[++now].first = qu[i][2], li[now].second = -i;
  sort(li + 1, li + now + 1);
  li[0].first = int(1e9);
  for (int i = 1; i <= now; i++) {
    st += li[i].first != li[i - 1].first;
    if (li[i].second < 0)
      qu[-li[i].second][2] = st;
    else
      qu[li[i].second][1] = st;
  }
  return;
}
int Find(int x) { return fa[x] == x ? x : (fa[x] = Find(fa[x])); }
inline void Update(int x, int y) {
  qu[0][1] = min(qu[0][1], x);
  qu[0][2] = max(qu[0][2], y);
}
void Merge(int x, int y, int z, int o) {
  int i = x + y >> 1, j = z << 1;
  while (!s[z].empty()) {
    int k = Find(s[z].back());
    s[z].pop_back();
    if (k == m) continue;
    Update(qu[sg[k]][1], qu[sg[k]][2]);
    fa[k] = m;
  }
  if (x == y) return;
  if (o <= i)
    Merge(x, i, j, o);
  else
    Merge(i + 1, y, j + 1, o);
}
void Modify(int x, int y, int z, int o, int p) {
  int i = x + y >> 1, j = z << 1;
  if (x == o && y == p) {
    s[z].push_back(m);
    return;
  }
  if (p <= i)
    Modify(x, i, j, o, p);
  else if (o > i)
    Modify(i + 1, y, j + 1, o, p);
  else
    Modify(x, i, j, o, i), Modify(i + 1, y, j + 1, i + 1, p);
}
int main() {
  n = Read();
  for (int i = 1; i <= n; i++)
    qu[i][0] = Read(), qu[i][1] = Read(), qu[i][2] = Read();
  Pretreat();
  for (int i = 1; i <= n; i++)
    if (qu[i][0] == 1) {
      m++;
      sg[fa[m] = m] = i;
      qu[0][1] = qu[i][1];
      qu[0][2] = qu[i][2];
      Merge(1, st, 1, qu[i][1]);
      Merge(1, st, 1, qu[i][2]);
      qu[i][1] = qu[0][1];
      qu[i][2] = qu[0][2];
      if (qu[i][1] < qu[i][2] - 1) Modify(1, st, 1, qu[i][1] + 1, qu[i][2] - 1);
    } else {
      int k = sg[Find(qu[i][1])], l = sg[Find(qu[i][2])];
      if (k == l || (qu[k][1] > qu[l][1] && qu[k][1] < qu[l][2]) ||
          (qu[k][2] > qu[l][1] && qu[k][2] < qu[l][2]))
        puts("YES");
      else
        puts("NO");
    }
  return 0;
}
