#include <bits/stdc++.h>
using namespace std;
int n, m, q;
const int N = 1e5 + 100;
vector<int> v[N << 2];
int fa[N], qu[N][3], num[N];
int father(int x) { return fa[x] == x ? x : fa[x] = father(fa[x]); }
void uni(int x, int y) {
  x = father(x), y = father(y);
  if (x != y) {
    fa[x] = y;
    qu[y][1] = min(qu[y][1], qu[x][1]);
    qu[y][2] = max(qu[y][2], qu[x][2]);
  }
}
void getunionn(int x, int l, int r, int pos, int t) {
  if (v[x].size()) {
    for (int i = 0; i < v[x].size(); i++) uni(v[x][i], t);
    v[x].clear();
    v[x].push_back(t);
  }
  if (l == r) return;
  int mid = (l + r) / 2;
  if (pos <= mid)
    getunionn(x * 2, l, mid, pos, t);
  else
    getunionn(x * 2 + 1, mid + 1, r, pos, t);
}
void update(int x, int l, int r, int L, int R, int t) {
  if (l == L && r == R) {
    v[x].push_back(t);
    return;
  }
  int mid = (l + r) / 2;
  if (L <= mid) update(x * 2, l, mid, L, min(R, mid), t);
  if (R > mid) update(x * 2 + 1, mid + 1, r, max(L, mid + 1), R, t);
}
bool in(int x, int l, int r) { return l < x && x < r; }
int main() {
  cin >> q;
  for (int i = 1; i <= q; i++)
    for (int j = 0; j < 3; j++) cin >> qu[i][j];
  vector<int> ve;
  for (int i = 1; i <= q; i++)
    if (qu[i][0] == 1) {
      ve.push_back(qu[i][1]);
      ve.push_back(qu[i][2]);
    }
  sort(ve.begin(), ve.end());
  ve.erase(unique(ve.begin(), ve.end()), ve.end());
  n = ve.size();
  for (int i = 1; i <= q; i++)
    if (qu[i][0] == 1) {
      qu[i][1] = lower_bound(ve.begin(), ve.end(), qu[i][1]) - ve.begin() + 1;
      qu[i][2] = lower_bound(ve.begin(), ve.end(), qu[i][2]) - ve.begin() + 1;
    }
  for (int i = 1; i <= q; i++) fa[i] = i;
  for (int t = 1; t <= q; t++) {
    int op = qu[t][0], x = qu[t][1], y = qu[t][2];
    if (op == 1) {
      num[++m] = t;
      getunionn(1, 1, n, x, t);
      getunionn(1, 1, n, y, t);
      if (x < y - 1) update(1, 1, n, x + 1, y - 1, t);
    } else {
      x = num[x], y = num[y];
      x = father(x), y = father(y);
      if (x == y || in(qu[x][1], qu[y][1], qu[y][2]) ||
          in(qu[x][2], qu[y][1], qu[y][2]))
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
  return 0;
}
