#include <bits/stdc++.h>
using namespace std;
struct question {
  int x, y, op;
} ques[1000000 + 5];
int le[1000000 + 5], ri[1000000 + 5], cnt = 0, father[1000000 + 5], n = 0,
                                      num[1000000 + 5], mx;
vector<int> v[1000000 + 5];
bool vis[1000000 + 5];
int getfather(int u) {
  return u == father[u] ? u : father[u] = getfather(father[u]);
}
void ui(int u, int v) {
  u = getfather(u), father[u] = v, le[v] = min(le[v], le[u]),
  ri[v] = max(ri[v], ri[u]);
}
bool ifin(int x, int y) {
  if (le[y] <= le[x] && ri[x] <= ri[y]) return 1;
  return 0;
}
void merge(int pos, int x, int l, int r, int p) {
  for (int i = 0; i < v[p].size(); i++) ui(v[p][i], x);
  if (v[p].size()) v[p].clear(), v[p].push_back(x);
  if (l == r) return;
  int mid = l + r >> 1;
  if (pos <= mid)
    merge(pos, x, l, mid, ((p) << 1));
  else
    merge(pos, x, mid + 1, r, ((p) << 1 | 1));
}
void insert(int ll, int rr, int x, int l, int r, int p) {
  if (ll <= l && r <= rr) {
    v[p].push_back(x);
    return;
  }
  int mid = l + r >> 1;
  if (ll <= mid) insert(ll, rr, x, l, mid, ((p) << 1));
  if (rr > mid) insert(ll, rr, x, mid + 1, r, ((p) << 1 | 1));
}
int main() {
  int q, op, x, y;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d%d%d", &ques[i].op, &ques[i].x, &ques[i].y);
    if (ques[i].op == 1) num[++cnt] = ques[i].x, num[++cnt] = ques[i].y;
  }
  sort(num + 1, num + 1 + cnt);
  cnt = unique(num + 1, num + 1 + cnt) - num - 1;
  mx = cnt;
  for (int i = 1; i <= q; i++) {
    if (ques[i].op == 1) {
      ques[i].x = lower_bound(num + 1, num + 1 + cnt, ques[i].x) - num,
      ques[i].y = lower_bound(num + 1, num + 1 + cnt, ques[i].y) - num;
      n++;
      father[n] = n;
      int l = ques[i].x, r = ques[i].y;
      le[n] = l, ri[n] = r;
      merge(l, n, 1, mx, 1), merge(r, n, 1, mx, 1);
      l = le[getfather(n)] + 1, r = ri[getfather(n)] - 1;
      if (l <= r) insert(l, r, n, 1, mx, 1);
    } else if (ifin(getfather(ques[i].x), getfather(ques[i].y)))
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
