#include <bits/stdc++.h>
using namespace std;
int N, P;
int T[100002], H[100002], L[100002], R[100002];
pair<int, pair<int, int> > Q[100002];
map<int, int> M;
vector<int> V;
int Find(int x) {
  if (T[T[x]] != T[x]) T[x] = Find(T[x]);
  return T[x];
}
void Union(int x, int y) {
  if (H[x] < H[y]) {
    T[x] = y;
    L[y] = min(L[x], L[y]);
    R[y] = max(R[x], R[y]);
  } else {
    T[y] = x;
    L[x] = min(L[x], L[y]);
    R[x] = max(R[x], R[y]);
    if (H[x] == H[y]) ++H[x];
  }
}
vector<int> ARB[4 * 600002];
int A1, A2, Ap, Av, Ar;
void update(int nod, int i1, int i2) {
  if (A1 <= i1 && i2 <= A2) {
    ARB[nod].push_back(Av);
    return;
  }
  int mid = (i1 + i2) / 2;
  if (A1 <= mid) update(nod * 2, i1, mid);
  if (A2 > mid) update(nod * 2 + 1, mid + 1, i2);
}
void query(int nod, int i1, int i2) {
  for (vector<int>::iterator it = ARB[nod].begin(); it != ARB[nod].end(); ++it)
    Union(Find(Av), Find(*it));
  ARB[nod].clear();
  if (i1 == i2) return;
  int mid = (i1 + i2) / 2;
  if (Ap <= mid)
    query(nod * 2, i1, mid);
  else
    query(nod * 2 + 1, mid + 1, i2);
}
int main() {
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    cin >> Q[i].first >> Q[i].second.first >> Q[i].second.second;
    V.push_back(Q[i].second.first - 1);
    V.push_back(Q[i].second.first);
    V.push_back(Q[i].second.first + 1);
    V.push_back(Q[i].second.second - 1);
    V.push_back(Q[i].second.second);
    V.push_back(Q[i].second.second + 1);
  }
  sort(V.begin(), V.end());
  V.resize(unique(V.begin(), V.end()) - V.begin());
  for (int i = 0; i < int(V.size()); ++i) M[V[i]] = i + 1;
  for (int i = 1, type, val1, val2; i <= N; ++i) {
    type = Q[i].first;
    val1 = Q[i].second.first;
    val2 = Q[i].second.second;
    if (type == 1) {
      ++P;
      T[P] = P;
      H[P] = 0;
      L[P] = val1;
      R[P] = val2;
      Ap = M[val1], Av = P;
      query(1, 1, V.size());
      Ap = M[val2], Av = P;
      query(1, 1, V.size());
      A1 = M[L[Find(P)] + 1], A2 = M[R[Find(P)] - 1], Av = P;
      if (A1 <= A2) update(1, 1, V.size());
    } else {
      if ((L[Find(val2)] < L[Find(val1)] && L[Find(val1)] < R[Find(val2)]) ||
          (L[Find(val2)] < R[Find(val1)] && R[Find(val1)] < R[Find(val2)])) {
        cout << "YES" << '\n';
        continue;
      }
      if (Find(val1) == Find(val2))
        cout << "YES" << '\n';
      else
        cout << "NO" << '\n';
    }
  }
}
