#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, t = 1, nn;
int p[N];
int lson[N * 4], rson[N * 4], used[N * 4];
pair<int, int> uni;
pair<int, int> edge[N];
vector<int> del;
vector<int> val[N * 4];
pair<int, pair<int, int> > eve[N];
map<int, int> mp;
void mge(pair<int, int> &x, pair<int, int> y) {
  x.first = min(x.first, y.first);
  x.second = max(x.second, y.second);
}
int fp(int x) { return (x == p[x]) ? x : (p[x] = fp(p[x])); }
void build(int pos, int x, int y) {
  if (x == y) return;
  int mid = (x + y) >> 1;
  lson[pos] = ++t;
  rson[pos] = ++t;
  build(lson[pos], x, mid);
  build(rson[pos], mid + 1, y);
}
void query(int pos, int x, int y, int l) {
  if (x <= l && y >= l) {
    for (int i = 0; i < val[pos].size(); i++) del.push_back(val[pos][i]);
    val[pos].clear();
  }
  if (x == y) return;
  if (x > l || y < l) return;
  int mid = (x + y) >> 1;
  query(lson[pos], x, mid, l);
  query(rson[pos], mid + 1, y, l);
}
void modify(int pos, int x, int y, int l, int r, int v) {
  if (x >= l && y <= r) {
    val[pos].push_back(v);
    return;
  }
  if (x > r || y < l) return;
  int mid = (x + y) >> 1;
  modify(lson[pos], x, mid, l, r, v);
  modify(rson[pos], mid + 1, y, l, r, v);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int o, x, y;
    scanf("%d%d%d", &o, &x, &y);
    eve[i] = make_pair(o, make_pair(x, y));
    if (o == 1) {
      mp[x];
      mp[y];
    }
  }
  for (int i = 1; i <= n; i++) p[i] = i;
  for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    it->second = ++m;
  for (int i = 1; i <= n; i++)
    if (eve[i].first == 1) {
      eve[i].second.first = mp[eve[i].second.first];
      eve[i].second.second = mp[eve[i].second.second];
    }
  build(1, 1, m);
  for (int i = 1; i <= n; i++) {
    int o = eve[i].first;
    int x = eve[i].second.first;
    int y = eve[i].second.second;
    if (o == 1) {
      nn++;
      del.clear();
      uni = make_pair(x + 1, y - 1);
      query(1, 1, m, x);
      query(1, 1, m, y);
      for (int i = 0; i < del.size(); i++) {
        del[i] = fp(del[i]);
        if (del[i] != nn) mge(uni, edge[del[i]]);
        p[del[i]] = nn;
      }
      if (uni.first <= uni.second) modify(1, 1, m, uni.first, uni.second, nn);
      edge[nn] = uni;
    } else {
      if (x > nn || y > nn) {
        puts("NO");
        continue;
      }
      x = fp(x);
      y = fp(y);
      if (x == y)
        puts("YES");
      else if (edge[x].first >= edge[y].first &&
               edge[x].second <= edge[y].second && edge[x] != edge[y])
        puts("YES");
      else
        puts("NO");
    }
  }
  return 0;
}
