//weighted union find algorithm..
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<climits>
#include<iterator>
#include<string>
#include<list>
#include<functional>
#include<bitset>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<numeric>
#define MOD 1000000007
using namespace std;
struct Node
{
    int start;
    int end;
};
vector<Node> arr;
vector<vector<int> > vi;
int marked[10000];
void dfs(int a)
{
    marked[a]=1;
    for(int i=0;i<vi[a].size();++i)
    {
        if(!marked[vi[a][i]])
            dfs(vi[a][i]);
    }
}

bool DFS(int a,int b)
{
    dfs(a);

    if(marked[b]==1)
        return 1;
    else
        return 0;
}

int  main()
{
    int N,x,a,b,point=0;
    cin>>N;
    Node temp;
    vi.resize(101);
    for(int i=0;i<N;++i)
    {
        cin>>x;
        if(x==1)
        {
            cin>>temp.start>>temp.end;
            ++point;
            for(int j=0;j<arr.size();++j)
            {
                if((temp.start>arr[j].start && temp.start<arr[j].end) || (temp.end>arr[j].start && temp.end<arr[j].end))
                    vi[point].push_back(j+1);

                if((arr[j].start>temp.start && arr[j].start<temp.end) || (arr[j].end>temp.start && arr[j].end<temp.end))
                    vi[j+1].push_back(point);
            }
            arr.push_back(temp);
        }
        else
        {
            fill_n(marked,101,0);
            cin>>a>>b;
            if(DFS(a,b))
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }
    }

    /*for(int i=0;i<vi.size();++i)
    {
        cout<<i<<"-> ";
        for(int j=0;j<vi[i].size();++j)
            cout<<vi[i][j]<<" ";
        cout<<endl;
    }*/
}


//weighted union find algorithm..
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<climits>
#include<iterator>
#include<string>
#include<list>
#include<functional>
#include<bitset>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<numeric>
#define MOD 1000000007

using namespace std;
class sset
{
    int P[105],rank[105],no[105],total;
public:
    void createset(int n)
    {
        int i,x,y,r;
        total=n;
        for(i=0; i<n; ++i)
        {
            P[i]=i;
            rank[i]=i;
            // no[i]=0;
        }
    }

    bool connected(int x,int y)
    {
        return findset(x)==findset(y);
    }
    void Union(int x,int y)
    {
        int px,py;
        px=findset(x);
        py=findset(y);
        if(px==py)
            return;
        if(rank[px]>rank[py])
        {
            P[py]=px;
            //  no[px]+=no[py];
        }
        else
        {
            P[px]=py;
            //   no[py]+=no[px];
        }
        if(rank[px]==rank[py]) rank[py]++;
        total--;
    }

    int findset(int x)
    {
        if(x==P[x])
            return x;
        else
            P[x]=findset(P[x]);
        return P[x];
    }

};

struct Node
{
    int strt;
    int end;
};

vector<Node> arr;
int main()
{
    int N,x,a,b,point=0;
    Node temp;
    cin>>N;
    sset w;
    w.createset(101);

    for(int i=0;i<N;++i)
    {
        cin>>x;
        if(x==1)
        {
            cin>>temp.strt;
            cin>>temp.end;
            for(int j=0;j<arr.size();++j)
            {
                if((temp.strt>arr[j].strt && temp.strt<arr[j].end) ^ (temp.end>arr[j].strt && temp.end<arr[j].end))
                {
                    w.Union(point,j);
                }
            }
            ++point;
            arr.push_back(temp);
        }
        else
        {
            cin>>a>>b;
            if(w.connected(a-1,b-1))
            cout<<"YES\n";
            else
            cout<<"NO\n";
        }
    }

}


//weighted union find algorithm..
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<climits>
#include<iterator>
#include<string>
#include<list>
#include<functional>
#include<bitset>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<numeric>
#define MOD 1000000007

using namespace std;
class Weighted_Union_Find
{
private:
    vector<int> id;
    vector<int> size;
    int components;

public:
    Weighted_Union_Find(int N)
    {
        components=N;
        for(int i=0;i<N;++i)id.push_back(i);
        for(int i=0;i<N;++i)size.push_back(1);
    }

    int Componnts()
    {return components;}

    bool connected(int p,int q)
    {return Find(p)==Find(q);}

    int Find(int p)
    {
        while(id[p]!=p)p=id[p];
        return p;
    }

    void Union(int p,int q)
    {
        int idp=Find(p);
        int idq=Find(q);
        if(idp==idq) return;

        else
        {
            components--;
            if(size[idp]>size[idq])
            {
                id[idq]=idp;
                size[p]+=size[q];
            }
            else
            {
                id[idp]=idq;
                size[q]+=size[p];
            }
        }
    }

};

struct Node
{
    int strt;
    int end;
};

vector<Node> arr;
int main()
{
    int N,x,a,b,point=0;
    Node temp;
    cin>>N;

    Weighted_Union_Find w(101);

    for(int i=0;i<N;++i)
    {
        cin>>x;
        if(x==1)
        {
            cin>>temp.strt;
            cin>>temp.end;
            ++point;
            for(int j=0;j<arr.size();++j)
            {
                if((temp.strt>arr[j].strt && temp.strt<arr[j].end) && (temp.end>arr[j].strt && temp.end<arr[j].end))continue;

                if((temp.strt>arr[j].strt && temp.strt<arr[j].end) || (temp.end>arr[j].strt && temp.end<arr[j].end))
                {
                    w.Union(point,j+1);
                    //cout<<point<<" "<<j+1<<endl;
                }
            }
            arr.push_back(temp);
        }
        else
        {
            cin>>a>>b;
            if(w.connected(a,b))
            cout<<"YES\n";
            else
            cout<<"NO\n";
        }
    }
}


//weighted union find algorithm..
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<climits>
#include<iterator>
#include<string>
#include<list>
#include<functional>
#include<bitset>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<numeric>
#define MOD 1000000007

using namespace std;
class sset
{
    int P[105],rank[105],no[105],total;
public:
    void createset(int n)
    {
        int i,x,y,r;
        total=n;
        for(i=0; i<n; ++i)
        {
            P[i]=i;
            rank[i]=i;
            // no[i]=0;
        }
    }

    bool connected(int x,int y)
    {
        return findset(x)==findset(y);
    }
    void Union(int x,int y)
    {
        int px,py;
        px=findset(x);
        py=findset(y);
        if(px==py)
            return;
        if(rank[px]>rank[py])
        {
            P[py]=px;
            //  no[px]+=no[py];
        }
        else
        {
            P[px]=py;
            //   no[py]+=no[px];
        }
        if(rank[px]==rank[py]) rank[py]++;
        total--;
    }

    int findset(int x)
    {
        if(x==P[x])
            return x;
        else
            P[x]=findset(P[x]);
        return P[x];
    }

};

struct Node
{
    int strt;
    int end;
};

vector<Node> arr;
int main()
{
    int N,x,a,b,point=0;
    Node temp;
    cin>>N;
    sset w;
    w.createset(101);

    for(int i=0;i<N;++i)
    {
        cin>>x;
        if(x==1)
        {
            cin>>temp.strt;
            cin>>temp.end;
            for(int j=0;j<arr.size();++j)
            {
                if((arr[j].strt>temp.strt && arr[j].strt<temp.end) ^ (arr[j].end>temp.strt && arr[j].end<temp.end))
                {
                    w.Union(point,j);
                }
            }
            ++point;
            arr.push_back(temp);
        }
        else
        {
            cin>>a>>b;
            if(w.connected(a-1,b-1))
            cout<<"YES\n";
            else
            cout<<"NO\n";
        }
    }

}


//weighted union find algorithm..
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<climits>
#include<iterator>
#include<string>
#include<list>
#include<functional>
#include<bitset>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<numeric>
#define MOD 1000000007
using namespace std;
struct Node
{
    int start;
    int end;
};
vector<Node> arr;
vector<vector<int> > vi;
int marked[10000];
void dfs(int a)
{
    marked[a]=1;
    for(int i=0;i<vi[a].size();++i)
    {
        if(!marked[vi[a][i]])
            dfs(vi[a][i]);
    }
}

bool DFS(int a,int b)
{
    dfs(a);

    if(marked[b]==1)
        return 1;
    else
        return 0;
}

int  main()
{
    int N,x,a,b,point=0;
    cin>>N;
    Node temp;
    vi.resize(101);
    for(int i=0;i<N;++i)
    {
        cin>>x;
        if(x==1)
        {
            cin>>temp.start>>temp.end;
            ++point;
            for(int j=0;j<arr.size();++j)
            {
                if((temp.start>arr[j].start && temp.start<arr[j].end) ^ (temp.end>arr[j].start && temp.end<arr[j].end))
                    vi[point].push_back(j+1);

                if((arr[j].start>temp.start && arr[j].start<temp.end) ^ (arr[j].end>temp.start && arr[j].end<temp.end))
                    vi[j+1].push_back(point);
            }
            arr.push_back(temp);
        }
        else
        {
            fill_n(marked,101,0);
            cin>>a>>b;
            if(DFS(a,b))
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }
    }

    /*for(int i=0;i<vi.size();++i)
    {
        cout<<i<<"-> ";
        for(int j=0;j<vi[i].size();++j)
            cout<<vi[i][j]<<" ";
        cout<<endl;
    }*/
}


//weighted union find algorithm..
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<climits>
#include<iterator>
#include<string>
#include<list>
#include<functional>
#include<bitset>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<numeric>
#define MOD 1000000007

using namespace std;
class Weighted_Union_Find
{
private:
    vector<int> id;
    vector<int> size;
    int components;

public:
    Weighted_Union_Find(int N)
    {
        components=N;
        for(int i=0;i<N;++i)id.push_back(i);
        for(int i=0;i<N;++i)size.push_back(1);
    }

    int Componnts()
    {return components;}

    bool connected(int p,int q)
    {return Find(p)==Find(q);}

    int Find(int p)
    {
        while(id[p]!=p)p=id[p];
        return p;
    }

    void Union(int p,int q)
    {
        int idp=Find(p);
        int idq=Find(q);
        if(idp==idq) return;
        id[idq]=idp;
    }

};

struct Node
{
    int strt;
    int end;
};

vector<Node> arr;
int main()
{
    int N,x,a,b,point=0;
    Node temp;
    cin>>N;

    Weighted_Union_Find w(101);

    for(int i=0;i<N;++i)
    {
        cin>>x;
        if(x==1)
        {
            cin>>temp.strt;
            cin>>temp.end;
            for(int j=0;j<arr.size();++j)
            {
                if((temp.strt>arr[j].strt && temp.strt<arr[j].end) ^ (temp.end>arr[j].strt && temp.end<arr[j].end))
                {
                    w.Union(point,j);
                }
            }
            ++point;
            arr.push_back(temp);
        }
        else
        {
            cin>>a>>b;
            if(w.connected(a-1,b-1))
            cout<<"YES\n";
            else
            cout<<"NO\n";
        }
    }
}


//weighted union find algorithm..
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<climits>
#include<iterator>
#include<string>
#include<list>
#include<functional>
#include<bitset>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<numeric>
#define MOD 1000000007

using namespace std;
class sset
{
    int P[105],rank[105],no[105],total;
public:
    void createset(int n)
    {
        int i,x,y,r;
        total=n;
        for(i=0; i<n; ++i)
        {
            P[i]=i;
            rank[i]=i;
            // no[i]=0;
        }
    }

    bool connected(int x,int y)
    {
        return findset(x)==findset(y);
    }
    void Union(int x,int y)
    {
        int px,py;
        px=findset(x);
        py=findset(y);
        if(px==py)
            return;
        if(rank[px]>rank[py])
        {
            P[py]=px;
            //  no[px]+=no[py];
        }
        else
        {
            P[px]=py;
            //   no[py]+=no[px];
        }
        if(rank[px]==rank[py]) rank[py]++;
        total--;
    }

    int findset(int x)
    {
        if(x==P[x])
            return x;
        else
            P[x]=findset(P[x]);
        return P[x];
    }

};

struct Node
{
    int strt;
    int end;
};

vector<Node> arr;
int main()
{
    int N,x,a,b,point=0;
    Node temp;
    cin>>N;
    sset w;
    w.createset(101);

    for(int i=0;i<N;++i)
    {
        cin>>x;
        if(x==1)
        {
            cin>>temp.strt;
            cin>>temp.end;
            for(int j=0;j<arr.size();++j)
            {
                if((arr[j].strt>temp.strt && arr[j].strt<temp.end) ^ (arr[j].end>temp.strt && arr[j].end<temp.end))
                {
                    w.Union(point,j);
                }
                else if((temp.strt>arr[j].strt && temp.strt<arr[j].end) || (temp.end>arr[j].strt && temp.end<arr[j].end))
                {
                    w.Union(point,j);
                }
            }
            ++point;
            arr.push_back(temp);
        }
        else
        {
            cin>>a>>b;
            if(w.connected(a-1,b-1))
            cout<<"YES\n";
            else
            cout<<"NO\n";
        }
    }

}


//weighted union find algorithm..
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<climits>
#include<iterator>
#include<string>
#include<list>
#include<functional>
#include<bitset>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<numeric>
#define MOD 1000000007

using namespace std;
//weighted union find algorithm..
#include <iostream>
#include <vector>
using namespace std;
class Weighted_Union_Find
{
private:
    vector<int> id;
    vector<int> size;
    int components;

public:
    Weighted_Union_Find(int N)
    {
        components=N;
        for(int i=0;i<N;++i)id.push_back(i);
        for(int i=0;i<N;++i)size.push_back(1);
    }

    int Componnts()
    {return components;}

    bool connected(int p,int q)
    {return Find(p)==Find(q);}

    int Find(int p)
    {
        while(id[p]!=p)p=id[p];
        return p;
    }

    void Union(int p,int q)
    {
        int idp=Find(p);
        int idq=Find(q);
        if(idp==idq) return;

        else
        {
            components--;
            if(size[idp]>size[idq])
            {
                id[idq]=idp;
                size[p]+=size[q];
            }
            else
            {
                id[idp]=idq;
                size[q]+=size[p];
            }
        }
    }

};

struct Node
{
    int strt;
    int end;
};

vector<Node> arr;
int main()
{
    int N,x,a,b,point=0;
    Node temp;
    cin>>N;
    Weighted_Union_Find w(101);

    for(int i=0;i<N;++i)
    {
        cin>>x;
        if(x==1)
        {
            cin>>temp.strt;
            cin>>temp.end;
            for(unsigned int j=0;j<arr.size();++j)
            {
               if((arr[j].strt>temp.strt && arr[j].strt<temp.end) ^(arr[j].end>temp.strt && arr[j].end<temp.end))
               {
                    w.Union(point,j);
               }
               if((temp.strt>arr[j].strt && temp.strt<arr[j].end) ^ (temp.end>arr[j].strt && temp.end<arr[j].end))
                {
                    w.Union(point,j);
                }
            }
            ++point;
            arr.push_back(temp);
        }
        else
        {
            cin>>a>>b;
            if(w.connected(a-1,b-1))
            cout<<"YES\n";
            else
            cout<<"NO\n";
        }
    }

}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

ll g[101]={0};

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=1,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			cin>>a>>b;
			if(a>b)
				swap(a,b);
			For(i,a,b+1){
				if((g[i]&&i>=x||i<=y)&&(a<=x&&(b>=x)||(a<=y)&&b>=y||(a>=x&&a<=y||b>=x&&b<=y))){
					printf("YES\n");
					break;
				}
				else {
					printf("NO\n");
					break;
				}
			}
		}
		else {
			cin>>x>>y;
			For(i,x,y+1)
				g[i]=1;
		}

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

struct bl {long x,y;}t;
vector<bool> viz;
vector<bl> g(1);
int n,a,b;

void DFS(int x){
	viz[x]=true;
	For(i,1,g.size())
		if(g[i].x<g[x].x&&g[x].x<g[i].y||g[i].x<g[x].y&&g[x].y<g[i].y&&!viz[i])
			DFS(i);
}

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	scanf("%d",&n);
	viz.resize(n+1,false);
	int x;
	For(i,0,n){
		scanf("%d",&x); x--;
		if(x){
			scanf("%d%d",&a,&b);

			DFS(a);
			if(viz[b])
				printf("YES\n");
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&t.x,&t.y);
			g.push_back(t);
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

struct bl {int x,y;}t;
bool viz[100];
vector<bl> g(1);

void DFS(int x){
	viz[x]=false;
	For(i,1,g.size())
		if(viz[i]&&(g[i].x<g[x].x&&g[x].x<g[i].y||g[i].x<g[x].y&&g[x].y<g[i].y))
			DFS(i);
}

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	int n,x;
	scanf("%d",&n);
	For(i,0,n){
		cin>>x>>t.x>>t.y; x--;
		if(x){
			For(i,1,g.size())
				viz[i]=true;
			DFS(t.x);
			if(viz[t.y])
				printf("NO\n");
			else printf("YES\n");
		}
		else g.push_back(t);
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);

	string s;
	s.resize(10000000,'.');
	long ind=10000000,a,b,x,y;
	int n,t;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&t); t--;
		if(t){
			scanf("%ld%ld",&a,&b);
			if(a>b)
				swap(a,b);
			if(a<=x&&b>=x||a<=y&&b>=y||(a>=x&&a<=y||b>=x&&b<=y)){
				size_t found=s.find_first_of(".");
				if(!found)
					printf("YES\n");
				else printf("NO\n");

			}
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&x,&y);
			x=abs(x);
			y=abs(y);
			if(x>y)
				swap(x,y);
			s.replace(x,1,y-x+1,'*');
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

struct bl {int x,y;}t;
vector<bool> viz;
vector<bl> g(1);
int n,a,b;

void DFS(int x){
	viz[x]=true;
	For(i,1,g.size())
		if(!viz[i]&&g[i].x<g[x].x&&g[x].x<g[i].y||g[i].x<g[x].y&&g[x].y<g[i].y)
			DFS(i);
}

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	scanf("%d",&n);
	viz.resize(n+1,false);
	int x;
	For(i,0,n){
		scanf("%d",&x); x--;
		if(x){
			scanf("%d%d",&a,&b);
			For(i,0,g.size())
				viz[i]=false;
			DFS(a);
			if(viz[b])
				printf("YES\n");
			else printf("NO\n");
		}
		else {
			scanf("%d%d",&t.x,&t.y);
			g.push_back(t);
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
	freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=1,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			cin>>a>>b;
			if(a>b)
				swap(a,b);
			if(a<=x&&(b>=x)||(a<=y)&&b>=y||(a>=x&&a<=y||b>=x&&b<=y))
				printf("YES\n");
			else printf("NO\n");
		}
		else cin>>x>>y;

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

ll g[101]={0};

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=1,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			int ind=0;
			cin>>a>>b;
			if(a>b)
				swap(a,b);
			For(i,a,b+1){
				if(a<=x&&(b>=x)||(a<=y)&&b>=y||(a>=x&&a<=y||b>=x&&b<=y)){
				if((g[i]&&i>=x||i<=y))
					printf("YES\n");
				ind++;
					break;
				}
				else {
					printf("NO\n");
					ind++;
					break;
				}
			}
			if(!ind)
				printf("NO\n");
		}
		else {
			cin>>x>>y;
			For(i,x,y+1)
				g[i]=1;
		}

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
//	freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=1,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			cin>>a>>b;
			if(a>b)
				swap(a,b);
			if(a<=x&&(b>=x)||(a<=y)&&b>=y||(a>=x&&b<=y))
				printf("YES\n");
			else printf("NO\n");
		}
		else cin>>x>>y;

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);

	string s;
	s.resize(20000000,'.');
	long ind=10000000,a,b,x,y;
	int n,t;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&t); t--;
		if(t){
			scanf("%ld%ld",&a,&b);
			if(a>b)
				swap(a,b);
			a+=ind;b+=ind;
			if(a<=x&&b>=x||a<=y&&b>=y||(a>=x&&a<=y||b>=x&&b<=y)){
				size_t found=s.find_first_of(".");
				if(!found)
					printf("YES\n");
				else printf("NO\n");

			}
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&x,&y);
			if(x>y)
				swap(x,y);
			x+=ind;
			y+=ind;
			s.replace(x,1,y-x+1,'*');
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);

	string s;
	s.resize(200000000,'.');
	long ind=100000000,a,b,x,y;
	int n,t;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&t); t--;
		if(t){
			scanf("%ld%ld",&a,&b);
			if(a>b)
				swap(a,b);
			a+=ind;b+=ind;
			if(a<=x&&b>=x||a<=y&&b>=y||(a>=x&&a<=y||b>=x&&b<=y)){
				size_t found=s.find_first_of(".");
				if(!found)
					printf("YES\n");
				else printf("NO\n");

			}
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&x,&y);
			if(x>y)
				swap(x,y);
			x+=ind;
			y+=ind;
			s.replace(x,1,y-x+1,'*');
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
//	freopen("in","r",stdin); freopen("out","w",stdout);
	int n,x=0,y,a,b;
	scanf("%d",&n);
	y=n;
	while(cin>>n){
		if(n==2){
			scanf("%d%d",&a,&b);
			if(x<=a&&y>=a||x<=b&&y>=b)
				printf("YES\n");
			else printf("NO\n");
		}
		else scanf("%d%d",&x,&y);

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);

	string s;
	s.resize(10000000,'.');
	long ind=10000000,a,b,x,y;
	int n,t;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&t); t--;
		if(t){
			scanf("%ld%ld",&a,&b);
			if(a>b)
				swap(a,b);
			if(a<=x&&b>=x||a<=y&&b>=y||(a>=x&&a<=y||b>=x&&b<=y)){
				size_t found=s.find_first_of(".");
				if(!found)
					printf("YES\n");
				else printf("NO\n");

			}
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&x,&y);
			x+=abs(x);
			y+=abs(y);
			if(x>y)
				swap(x,y);
			s.replace(x,1,y-x+1,'*');
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

struct bl {long x,y;}t;
vector<bool> viz;
vector<bl> g(1);
int n,a,b;

void DFS(int x){
	viz[x]=true;
	For(i,1,g.size())
		if(g[i].x<g[x].x&&g[x].x<g[i].y||g[i].x<g[x].y&&g[x].y<g[i].y&&!viz[i])
			DFS(i);
}

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	scanf("%d",&n);
	viz.resize(n+1,false);
	int x;
	For(i,0,n){
		scanf("%d",&x); x--;
		if(x){
			scanf("%d%d",&a,&b);
			viz.clear();
			viz.resize(n+1,false);
			DFS(a);
			if(viz[b])
				printf("YES\n");
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&t.x,&t.y);
			g.push_back(t);
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
	freopen("in","r",stdin); freopen("out","w",stdout);

	string s;
	s.resize(20000000,'.');
	long ind=10000000,a,b,x,y;
	int n,t;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&t); t--;
		if(t){
			scanf("%ld%ld",&a,&b);
			if(a>b)
				swap(a,b);
			a+=ind;b+=ind;
			if((a>=x&&a<=y||b>=x&&b<=y)){
				size_t found=s.find_first_of(".");
				if(!found)
					printf("YES\n");
				else printf("NO\n");

			}
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&x,&y);
			if(x>y)
				swap(x,y);
			x+=ind;
			y+=ind;
			s.replace(x,1,y-x+1,'*');
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);

	string s;
	s.resize(10000000,'.');
	long ind=10000000,a,b,x,y;
	int n,t;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&t); t--;
		if(t){
			scanf("%ld%ld",&a,&b);
			if(a>b)
				swap(a,b);
			if(a<=x&&b>=x||a<=y&&b>=y||(a>=x&&a<=y||b>=x&&b<=y)){
				size_t found=s.find_first_of(".");
				if(!found)
					printf("YES\n");
				else printf("NO\n");

			}
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&x,&y);
			if(x>y)
				swap(x,y);
			x+=abs(x);
			y+=abs(y);
			s.replace(x,1,y-x+1,'*');
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
//	freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=0,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			cin>>a>>b;
			if((x<=a&&y>=a||x<=b&&y>=b)||(a<x&&b>y||b<x&&a>y))
				printf("YES\n");
			else printf("NO\n");
		}
		else cin>>x>>y;

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

struct bl {int x,y;}t;
bool viz[100];
vector<bl> g(1);

void DFS(int x){
	viz[x]=false;
	For(i,1,g.size())
		if(viz[i]&&(g[i].x<g[x].x&&g[x].x<g[i].y||g[i].x<g[x].y&&g[x].y<g[i].y))
			DFS(i);
}

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	int n,x;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&x,&t.x,&t.y); x--;
		if(x){
			For(i,1,g.size())
				viz[i]=true;
			DFS(t.x);
			if(viz[t.y])
				printf("NO\n");
			else printf("YES\n");
		}
		else g.push_back(t);
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
//	freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=0,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			cin>>a>>b;
			if(a>b)
				swap(a,b);
			if((a<=x&&!(b<x)||!(a>y)&&b>=y)||(a>=x&&b<=y))
				printf("YES\n");
			else printf("NO\n");
		}
		else cin>>x>>y;

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

ll g[101]={0};

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=1,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			int ind=0;
			cin>>a>>b;
			if(a>b)
				swap(a,b);
			For(i,a,b+1){
				if((a<=x&&(b>=x)||(a<=y)&&b>=y||(a>=x&&a<=y||b>=x&&b<=y))){
				if((g[i]&&i>=x||i<=y))
					printf("YES\n");
				ind++;
					break;
				}
				else {
					printf("NO\n");
					ind++;
					break;
				}
			}
			if(!ind)
				printf("NO\n");
		}
		else {
			cin>>x>>y;
			For(i,x,y+1)
				g[i]=1;
		}

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

struct bl{long x,y;};
int main(){
	freopen("in","r",stdin); freopen("out","w",stdout);

	bl g[101];
	string s;
	s.resize(50,'.');
	long ind=0,x,y,x1,y1;
	int n,t,a,b,j=1;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&t); t--;
		if(t){
			scanf("%d%d",&a,&b);
			x=g[a].x; y=g[a].y;
			x1=g[b].x; y1=g[b].y;
			size_t found=s.find_first_of(".");
				if(!found)
					printf("YES\n");
				else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&x,&y);
			if(x>y)
				swap(x,y);
			g[j].x=x;
			g[j].y=y;
			j++;
			x+=ind+1;
			y+=ind-1;
			s.replace(x,1,y-x+1,'*');
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

struct bl {int x,y;}t;
vector<bool> viz(100);
vector<bl> g(1);

void DFS(int x){
	viz[x]=true;
	For(i,1,g.size())
		if(!viz[i]&&g[i].x<g[x].x&&g[x].x<g[i].y||g[i].x<g[x].y&&g[x].y<g[i].y) DFS(i);
}

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	int n,x;
	scanf("%d",&n);
	For(i,0,n){
		scanf("%d",&x,&t.x,&t.y); x--;
		if(x){
			For(i,0,g.size())
				viz[i]=false;
			DFS(t.x);
			if(viz[t.y])
				printf("YES\n");
			else printf("NO\n");
		}
		else g.push_back(t);
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
//	freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=0,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			cin>>a>>b;
			if(x<=a&&y>=a||x<=b&&y>=b)
				printf("YES\n");
			else printf("NO\n");
		}
		else cin>>x>>y;

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

struct bl {long x,y;}t;
vector<bool> viz;
vector<bl> g(1);
int n,a,b;

void DFS(int x){
	viz[x]=true;
	For(i,1,g.size())
		if(g[i].x<g[x].x&&g[x].x<g[i].y||g[i].x<g[x].y&&g[x].y<g[i].y&&!viz[i])
			DFS(i);
}

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	scanf("%d",&n);
	viz.resize(n+1,false);
	int x;
	For(i,0,n){
		scanf("%d",&x); x--;
		if(x){
			scanf("%d%d",&a,&b);
			For(i,0,g.size())
				viz[i]=false;
			DFS(a);
			if(viz[b])
				printf("YES\n");
			else printf("NO\n");
		}
		else {
			scanf("%ld%ld",&t.x,&t.y);
			g.push_back(t);
		}
	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <iterator>
#include <string>
#include <cmath>
#define pi 3.14159265359
#define inf 100000000000
#define ll long long
#define ld long double
#define For(i,a,t) for(int i=a; i<t;i++)
#define For1(i,a,t) for(int i=a; i>=t;i--)
using namespace std;

int main(){
	//freopen("in","r",stdin); freopen("out","w",stdout);
	ll n,x=1,y,a,b;
	cin>>n;
	y=n;
	while(cin>>n){
		if(n==2){
			cin>>a>>b;
			if(a>b)
				swap(a,b);
			if(a<=x&&(b>=x)||(a<=y)&&b>=y||(a>=x&&a<=y||b>=x&&b<=y))
				printf("YES\n");
			else printf("NO\n");
		}
		else cin>>x>>y;

	}

 	// cout<<fixed<<setprecision(3);
	return 0;
}


#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <climits>

/**********TYPE CASTING**********/
#define LL long long
#define L long
#define D double
#define LD long double
#define S string
#define I int
#define ULL unsigned long long
#define q queue<int>
#define vi vector<int>
#define vl vector<long>

/**********INPUT**********/
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%ld",&a)
#define s1(a) scanf("%d",&a)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",&a)
#define gc() getchar()

/**********OUTPUT**********/
#define p1(a) printf("%d\n",a)
#define p2(a,b) printf("%d %d\n",a,b)
#define pll(a) printf("%lld\n",a)
#define pd(a) printf("%.10lf\n",a)
#define pcs(a,n) printf("Case %d: %d\n",a,n)
#define nl() printf("\n")

/**********LOOP**********/
#define REV(i,e,s) for(i=e;i>=s;i--)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define loop(n) for(int o=1;o<=n;o++)

/********** min/max *******/
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) mix(a,max(b,c))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))

/**********SHORTCUT**********/
#define len(a) a.length()
#define SET(a,x) memset(a,x,sizeof a)
#define VI vector<int>
#define PB push_back
#define SZ size()
#define CLR clear()
#define PB(A) push_back(A)
#define clr(a,b) memset(a,b,sizeof(a))

/**********CONSTANT**********/
#define MIN INT_MIN
#define PI 2acos(-1.0)
#define INF 2<<15
#define MOD 1000000007
#define MAX 1000001

using namespace std;

/*

LL gcd(LL a,LL b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}

LL bigmod(LL p,LL e,LL M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        LL t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}

LL modinverse(LL a,LL M)
{
    return bigmod(a,M-2,M);
}

bool is_prime[MAX];
L prime[MAX];

bool sieve()
{
    long i,j;
    prime[0]=2;
    int k=1;
    int sq=(sqrt(MAX));
    for(i=3; i<=sq; i+=2)
    {
        if(!is_prime[i])
        {
            for(j=i*i; j<=MAX; j+=(2*i))
                is_prime[j]=1;
        }
    }
    for(j=3; j<=MAX; j+=2)
    {
        if(!is_prime[j])
        {
            prime[k++]=j;
        }
    }
}

long NOD(long n)
{
    int  i,j,k;
    long sq=sqrt(n);
    long res=1;
    for(i=0; prime[i]<=sq; i++)
    {
        int cnt=1;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                cnt++;
                n=n/prime[i];
                if(n==1) break;
            }
            res*=cnt;
            sq=sqrt(n);
        }
    }
    if(n>1) res*=2;
    return res;
}
*/

int main()
{
    // FILE * fin, * fout;
    // fin=fopen("input.txt","r");
    // fout=fopen("output.txt","w");

    int i,j,k;
    int op,n;
    LL a,b;
    LL arr1[101],arr2[101];
    cin>>n;
    k=0;
    loop(n)
    {
        cin>>op>>a>>b;
        if(op==1)
        {
            arr1[k]=a;
            arr2[k]=b;
            k++;
        }
        else
        {
            LL low=arr1[a-1];
            LL high=arr2[a-1];
            loop(k+5)
            {
                for(i=0; i<k; i++)
                {
                    if(arr1[i]<low && arr2[i]>low)
                    {
                        low=min(low,arr1[i]);
                    }
                    if(arr1[i]<high && arr2[i]>high)
                    {
                        high=max(high,arr2[i]);
                    }
                }
                //cout<<low<<" "<<high<<endl;
                LL lowa=low;
                LL higha=high;
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                {
                    cout<<"YES"<<endl;
                    //     cout<<low<<" "<<high<<endl;

                    return 0;
                }
            }
            //   cout<<low<<" "<<high<<endl;

            if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                cout<<"YES"<<endl;
            else
                cout<<"NO"<<endl;

        }
    }

    return 0;
}


#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <climits>

/**********TYPE CASTING**********/
#define LL long long
#define L long
#define D double
#define LD long double
#define S string
#define I int
#define ULL unsigned long long
#define q queue<int>
#define vi vector<int>
#define vl vector<long>

/**********INPUT**********/
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%ld",&a)
#define s1(a) scanf("%d",&a)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",&a)
#define gc() getchar()

/**********OUTPUT**********/
#define p1(a) printf("%d\n",a)
#define p2(a,b) printf("%d %d\n",a,b)
#define pll(a) printf("%lld\n",a)
#define pd(a) printf("%.10lf\n",a)
#define pcs(a,n) printf("Case %d: %d\n",a,n)
#define nl() printf("\n")

/**********LOOP**********/
#define REV(i,e,s) for(i=e;i>=s;i--)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define loop(n) for(int o=1;o<=n;o++)

/********** min/max *******/
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) mix(a,max(b,c))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))

/**********SHORTCUT**********/
#define len(a) a.length()
#define SET(a,x) memset(a,x,sizeof a)
#define VI vector<int>
#define PB push_back
#define SZ size()
#define CLR clear()
#define PB(A) push_back(A)
#define clr(a,b) memset(a,b,sizeof(a))

/**********CONSTANT**********/
#define MIN INT_MIN
#define PI 2acos(-1.0)
#define INF 2<<15
#define MOD 1000000007
#define MAX 1000001

using namespace std;

/*

LL gcd(LL a,LL b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}

LL bigmod(LL p,LL e,LL M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        LL t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}

LL modinverse(LL a,LL M)
{
    return bigmod(a,M-2,M);
}

bool is_prime[MAX];
L prime[MAX];

bool sieve()
{
    long i,j;
    prime[0]=2;
    int k=1;
    int sq=(sqrt(MAX));
    for(i=3; i<=sq; i+=2)
    {
        if(!is_prime[i])
        {
            for(j=i*i; j<=MAX; j+=(2*i))
                is_prime[j]=1;
        }
    }
    for(j=3; j<=MAX; j+=2)
    {
        if(!is_prime[j])
        {
            prime[k++]=j;
        }
    }
}

long NOD(long n)
{
    int  i,j,k;
    long sq=sqrt(n);
    long res=1;
    for(i=0; prime[i]<=sq; i++)
    {
        int cnt=1;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                cnt++;
                n=n/prime[i];
                if(n==1) break;
            }
            res*=cnt;
            sq=sqrt(n);
        }
    }
    if(n>1) res*=2;
    return res;
}
*/

I k;
vl V[101];
bool vis[101];

void DFS(int s)
{
    vis[s]=true;
    L a=V[s][0];
    L b=V[s][1];
    for(I i=0; i<k; i++)
    {
        if(!vis[i])
        {
            L c=V[i][0];
            L d=V[i][1];
            if((c<a && a<d) || (c<b && b<d))
                DFS(i);
        }
    }
}

int main()
{
    // FILE * fin, * fout;
    // fin=fopen("input.txt","r");
    // fout=fopen("output.txt","w");

    int i,j;
    int op,n;
    LL a,b;
    LL arr1[101],arr2[101];
    cin>>n;
    k=0;
    loop(n)
    {
        cin>>op>>a>>b;
        if(op==1)
        {
            V[k].PB(a);
            V[k].PB(b);
            k++;
        }
        else
        {
            clr(vis,0);
            DFS(a-1);
            if(vis[b-1])
                cout<<"YES"<<endl;
            else
                cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <climits>

/**********TYPE CASTING**********/
#define LL long long
#define L long
#define D double
#define LD long double
#define S string
#define I int
#define ULL unsigned long long
#define q queue<int>
#define vi vector<int>
#define vl vector<long>

/**********INPUT**********/
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%ld",&a)
#define s1(a) scanf("%d",&a)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",&a)
#define gc() getchar()

/**********OUTPUT**********/
#define p1(a) printf("%d\n",a)
#define p2(a,b) printf("%d %d\n",a,b)
#define pll(a) printf("%lld\n",a)
#define pd(a) printf("%.10lf\n",a)
#define pcs(a,n) printf("Case %d: %d\n",a,n)
#define nl() printf("\n")

/**********LOOP**********/
#define REV(i,e,s) for(i=e;i>=s;i--)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define loop(n) for(int o=1;o<=n;o++)

/********** min/max *******/
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) mix(a,max(b,c))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))

/**********SHORTCUT**********/
#define len(a) a.length()
#define SET(a,x) memset(a,x,sizeof a)
#define VI vector<int>
#define PB push_back
#define SZ size()
#define CLR clear()
#define PB(A) push_back(A)
#define clr(a,b) memset(a,b,sizeof(a))

/**********CONSTANT**********/
#define MIN INT_MIN
#define PI 2acos(-1.0)
#define INF 2<<15
#define MOD 1000000007
#define MAX 1000001

using namespace std;

/*

LL gcd(LL a,LL b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}

LL bigmod(LL p,LL e,LL M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        LL t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}

LL modinverse(LL a,LL M)
{
    return bigmod(a,M-2,M);
}

bool is_prime[MAX];
L prime[MAX];

bool sieve()
{
    long i,j;
    prime[0]=2;
    int k=1;
    int sq=(sqrt(MAX));
    for(i=3; i<=sq; i+=2)
    {
        if(!is_prime[i])
        {
            for(j=i*i; j<=MAX; j+=(2*i))
                is_prime[j]=1;
        }
    }
    for(j=3; j<=MAX; j+=2)
    {
        if(!is_prime[j])
        {
            prime[k++]=j;
        }
    }
}

long NOD(long n)
{
    int  i,j,k;
    long sq=sqrt(n);
    long res=1;
    for(i=0; prime[i]<=sq; i++)
    {
        int cnt=1;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                cnt++;
                n=n/prime[i];
                if(n==1) break;
            }
            res*=cnt;
            sq=sqrt(n);
        }
    }
    if(n>1) res*=2;
    return res;
}
*/

int main()
{
    // FILE * fin, * fout;
    // fin=fopen("input.txt","r");
    // fout=fopen("output.txt","w");

    int i,j,k;
    int op,n;
    LL a,b;
    LL arr1[101],arr2[101];
    cin>>n;
    k=0;
    loop(n)
    {
        cin>>op>>a>>b;
        if(op==1)
        {
            arr1[k]=a;
            arr2[k]=b;
            k++;
        }
        else
        {
            LL low=arr1[a-1];
            LL high=arr2[a-1];
            bool c=1;
            loop(k)
            {
                for(i=0; i<k; i++)
                {
                    if(arr1[i]<low && arr2[i]>low)
                    {
                        low=min(low,arr1[i]);
                    }
                    if(arr1[i]<high && arr2[i]>high)
                    {
                        high=max(high,arr2[i]);
                    }
                }
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }

            }
            if(c)
            {
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                    cout<<"YES"<<endl;

                else
                    cout<<"NO"<<endl;
            }

        }
    }

    return 0;
}


#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <climits>

/**********TYPE CASTING**********/
#define LL long long
#define L long
#define D double
#define LD long double
#define S string
#define I int
#define ULL unsigned long long
#define q queue<int>
#define vi vector<int>
#define vl vector<long>

/**********INPUT**********/
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%ld",&a)
#define s1(a) scanf("%d",&a)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",&a)
#define gc() getchar()

/**********OUTPUT**********/
#define p1(a) printf("%d\n",a)
#define p2(a,b) printf("%d %d\n",a,b)
#define pll(a) printf("%lld\n",a)
#define pd(a) printf("%.10lf\n",a)
#define pcs(a,n) printf("Case %d: %d\n",a,n)
#define nl() printf("\n")

/**********LOOP**********/
#define REV(i,e,s) for(i=e;i>=s;i--)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define loop(n) for(int o=1;o<=n;o++)

/********** min/max *******/
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) mix(a,max(b,c))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))

/**********SHORTCUT**********/
#define len(a) a.length()
#define SET(a,x) memset(a,x,sizeof a)
#define VI vector<int>
#define PB push_back
#define SZ size()
#define CLR clear()
#define PB(A) push_back(A)
#define clr(a,b) memset(a,b,sizeof(a))

/**********CONSTANT**********/
#define MIN INT_MIN
#define PI 2acos(-1.0)
#define INF 2<<15
#define MOD 1000000007
#define MAX 1000001

using namespace std;

/*

LL gcd(LL a,LL b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}

LL bigmod(LL p,LL e,LL M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        LL t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}

LL modinverse(LL a,LL M)
{
    return bigmod(a,M-2,M);
}

bool is_prime[MAX];
L prime[MAX];

bool sieve()
{
    long i,j;
    prime[0]=2;
    int k=1;
    int sq=(sqrt(MAX));
    for(i=3; i<=sq; i+=2)
    {
        if(!is_prime[i])
        {
            for(j=i*i; j<=MAX; j+=(2*i))
                is_prime[j]=1;
        }
    }
    for(j=3; j<=MAX; j+=2)
    {
        if(!is_prime[j])
        {
            prime[k++]=j;
        }
    }
}

long NOD(long n)
{
    int  i,j,k;
    long sq=sqrt(n);
    long res=1;
    for(i=0; prime[i]<=sq; i++)
    {
        int cnt=1;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                cnt++;
                n=n/prime[i];
                if(n==1) break;
            }
            res*=cnt;
            sq=sqrt(n);
        }
    }
    if(n>1) res*=2;
    return res;
}
*/

int main()
{
    // FILE * fin, * fout;
    // fin=fopen("input.txt","r");
    // fout=fopen("output.txt","w");

    int i,j,k;
    int op,n;
    LL a,b;
    LL arr1[101],arr2[101];
    cin>>n;
    k=0;
    loop(n)
    {
        cin>>op>>a>>b;
        if(op==1)
        {
            arr1[k]=a;
            arr2[k]=b;
            k++;
        }
        else
        {
            LL low=arr1[a-1];
            LL high=arr2[a-1];
            bool c=1;
            loop(k+5)
            {
                for(i=0; i<k; i++)
                {
                    if(arr1[i]<low && arr2[i]>low)
                    {
                        low=min(low,arr1[i]);
                    }
                    if(arr1[i]<high && arr2[i]>high)
                    {
                        high=max(high,arr2[i]);
                    }
                }
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }
                else if((low<arr1[b-1] && arr1[b-1]<high) || (low<arr2[b-1] && arr2[b-1]<high))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }
            }
            if(c)
            {
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                    cout<<"YES"<<endl;
                else if((low<arr1[b-1] && arr1[b-1]<high) || (low<arr2[b-1] && arr2[b-1]<high))
                    cout<<"YES"<<endl;
                else
                    cout<<"NO"<<endl;
            }

        }
    }

    return 0;
}


#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <climits>

/**********TYPE CASTING**********/
#define LL long long
#define L long
#define D double
#define LD long double
#define S string
#define I int
#define ULL unsigned long long
#define q queue<int>
#define vi vector<int>
#define vl vector<long>

/**********INPUT**********/
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%ld",&a)
#define s1(a) scanf("%d",&a)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",&a)
#define gc() getchar()

/**********OUTPUT**********/
#define p1(a) printf("%d\n",a)
#define p2(a,b) printf("%d %d\n",a,b)
#define pll(a) printf("%lld\n",a)
#define pd(a) printf("%.10lf\n",a)
#define pcs(a,n) printf("Case %d: %d\n",a,n)
#define nl() printf("\n")

/**********LOOP**********/
#define REV(i,e,s) for(i=e;i>=s;i--)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define loop(n) for(int o=1;o<=n;o++)

/********** min/max *******/
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) mix(a,max(b,c))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))

/**********SHORTCUT**********/
#define len(a) a.length()
#define SET(a,x) memset(a,x,sizeof a)
#define VI vector<int>
#define PB push_back
#define SZ size()
#define CLR clear()
#define PB(A) push_back(A)
#define clr(a,b) memset(a,b,sizeof(a))

/**********CONSTANT**********/
#define MIN INT_MIN
#define PI 2acos(-1.0)
#define INF 2<<15
#define MOD 1000000007
#define MAX 1000001

using namespace std;

/*

LL gcd(LL a,LL b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}

LL bigmod(LL p,LL e,LL M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        LL t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}

LL modinverse(LL a,LL M)
{
    return bigmod(a,M-2,M);
}

bool is_prime[MAX];
L prime[MAX];

bool sieve()
{
    long i,j;
    prime[0]=2;
    int k=1;
    int sq=(sqrt(MAX));
    for(i=3; i<=sq; i+=2)
    {
        if(!is_prime[i])
        {
            for(j=i*i; j<=MAX; j+=(2*i))
                is_prime[j]=1;
        }
    }
    for(j=3; j<=MAX; j+=2)
    {
        if(!is_prime[j])
        {
            prime[k++]=j;
        }
    }
}

long NOD(long n)
{
    int  i,j,k;
    long sq=sqrt(n);
    long res=1;
    for(i=0; prime[i]<=sq; i++)
    {
        int cnt=1;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                cnt++;
                n=n/prime[i];
                if(n==1) break;
            }
            res*=cnt;
            sq=sqrt(n);
        }
    }
    if(n>1) res*=2;
    return res;
}
*/

int main()
{
    // FILE * fin, * fout;
    // fin=fopen("input.txt","r");
    // fout=fopen("output.txt","w");

    int i,j,k;
    int op,n;
    LL a,b;
    LL arr1[101],arr2[101];
    cin>>n;
    k=0;
    loop(n)
    {
        cin>>op>>a>>b;
        if(op==1)
        {
            arr1[k]=a;
            arr2[k]=b;
            k++;
        }
        else
        {
            LL low=arr1[a-1];
            LL high=arr2[a-1];
            bool c=1;
            loop(k)
            {
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }
                else if((low<arr1[b-1] && arr1[b-1]<high) || (low<arr2[b-1] && arr2[b-1]<high))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }
                for(i=0; i<k; i++)
                {
                    if(arr1[i]<low && arr2[i]>low)
                    {
                        low=min(low,arr1[i]);
                    }
                    if(arr1[i]<high && arr2[i]>high)
                    {
                        high=max(high,arr2[i]);
                    }
                }
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }
                else if((low<arr1[b-1] && arr1[b-1]<high) || (low<arr2[b-1] && arr2[b-1]<high))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }
            }
            if(c)
            {
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                    cout<<"YES"<<endl;
                else if((low<arr1[b-1] && arr1[b-1]<high) || (low<arr2[b-1] && arr2[b-1]<high))
                    cout<<"YES"<<endl;
                else
                    cout<<"NO"<<endl;
            }

        }
    }

    return 0;
}


#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <climits>

/**********TYPE CASTING**********/
#define LL long long
#define L long
#define D double
#define LD long double
#define S string
#define I int
#define ULL unsigned long long
#define q queue<int>
#define vi vector<int>
#define vl vector<long>

/**********INPUT**********/
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%ld",&a)
#define s1(a) scanf("%d",&a)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",&a)
#define gc() getchar()

/**********OUTPUT**********/
#define p1(a) printf("%d\n",a)
#define p2(a,b) printf("%d %d\n",a,b)
#define pll(a) printf("%lld\n",a)
#define pd(a) printf("%.10lf\n",a)
#define pcs(a,n) printf("Case %d: %d\n",a,n)
#define nl() printf("\n")

/**********LOOP**********/
#define REV(i,e,s) for(i=e;i>=s;i--)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define loop(n) for(int o=1;o<=n;o++)

/********** min/max *******/
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) mix(a,max(b,c))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))

/**********SHORTCUT**********/
#define len(a) a.length()
#define SET(a,x) memset(a,x,sizeof a)
#define VI vector<int>
#define PB push_back
#define SZ size()
#define CLR clear()
#define PB(A) push_back(A)
#define clr(a,b) memset(a,b,sizeof(a))

/**********CONSTANT**********/
#define MIN INT_MIN
#define PI 2acos(-1.0)
#define INF 2<<15
#define MOD 1000000007
#define MAX 1000001

using namespace std;

/*

LL gcd(LL a,LL b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}

LL bigmod(LL p,LL e,LL M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        LL t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}

LL modinverse(LL a,LL M)
{
    return bigmod(a,M-2,M);
}

bool is_prime[MAX];
L prime[MAX];

bool sieve()
{
    long i,j;
    prime[0]=2;
    int k=1;
    int sq=(sqrt(MAX));
    for(i=3; i<=sq; i+=2)
    {
        if(!is_prime[i])
        {
            for(j=i*i; j<=MAX; j+=(2*i))
                is_prime[j]=1;
        }
    }
    for(j=3; j<=MAX; j+=2)
    {
        if(!is_prime[j])
        {
            prime[k++]=j;
        }
    }
}

long NOD(long n)
{
    int  i,j,k;
    long sq=sqrt(n);
    long res=1;
    for(i=0; prime[i]<=sq; i++)
    {
        int cnt=1;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                cnt++;
                n=n/prime[i];
                if(n==1) break;
            }
            res*=cnt;
            sq=sqrt(n);
        }
    }
    if(n>1) res*=2;
    return res;
}
*/

int main()
{
    // FILE * fin, * fout;
    // fin=fopen("input.txt","r");
    // fout=fopen("output.txt","w");

    int i,j,k;
    int op,n;
    LL a,b;
    LL arr1[101],arr2[101];
    cin>>n;
    k=0;
    loop(n)
    {
        cin>>op>>a>>b;
        if(op==1)
        {
            arr1[k]=a;
            arr2[k]=b;
            k++;
        }
        else
        {
            LL low=arr1[a-1];
            LL high=arr2[a-1];
            bool c=1;
            loop(k+5)
            {
                for(i=0; i<k; i++)
                {
                    if(arr1[i]<low && arr2[i]>low)
                    {
                        low=min(low,arr1[i]);
                    }
                    if(arr1[i]<high && arr2[i]>high)
                    {
                        high=max(high,arr2[i]);
                    }
                }
                //cout<<low<<" "<<high<<endl;
                LL lowa=low;
                LL higha=high;
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                {
                    cout<<"YES"<<endl;
                    c=0;
                }
            }
            //   cout<<low<<" "<<high<<endl;
            if(c)
            {
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]) && c)
                    cout<<"YES"<<endl;
                else
                    cout<<"NO"<<endl;
            }

        }
    }

    return 0;
}


#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <climits>

/**********TYPE CASTING**********/
#define LL long long
#define L long
#define D double
#define LD long double
#define S string
#define I int
#define ULL unsigned long long
#define q queue<int>
#define vi vector<int>
#define vl vector<long>

/**********INPUT**********/
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%ld",&a)
#define s1(a) scanf("%d",&a)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",&a)
#define gc() getchar()

/**********OUTPUT**********/
#define p1(a) printf("%d\n",a)
#define p2(a,b) printf("%d %d\n",a,b)
#define pll(a) printf("%lld\n",a)
#define pd(a) printf("%.10lf\n",a)
#define pcs(a,n) printf("Case %d: %d\n",a,n)
#define nl() printf("\n")

/**********LOOP**********/
#define REV(i,e,s) for(i=e;i>=s;i--)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define loop(n) for(int o=1;o<=n;o++)

/********** min/max *******/
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) mix(a,max(b,c))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))

/**********SHORTCUT**********/
#define len(a) a.length()
#define SET(a,x) memset(a,x,sizeof a)
#define VI vector<int>
#define PB push_back
#define SZ size()
#define CLR clear()
#define PB(A) push_back(A)
#define clr(a,b) memset(a,b,sizeof(a))

/**********CONSTANT**********/
#define MIN INT_MIN
#define PI 2acos(-1.0)
#define INF 2<<15
#define MOD 1000000007
#define MAX 1000001

using namespace std;

/*

LL gcd(LL a,LL b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}

LL bigmod(LL p,LL e,LL M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        LL t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}

LL modinverse(LL a,LL M)
{
    return bigmod(a,M-2,M);
}

bool is_prime[MAX];
L prime[MAX];

bool sieve()
{
    long i,j;
    prime[0]=2;
    int k=1;
    int sq=(sqrt(MAX));
    for(i=3; i<=sq; i+=2)
    {
        if(!is_prime[i])
        {
            for(j=i*i; j<=MAX; j+=(2*i))
                is_prime[j]=1;
        }
    }
    for(j=3; j<=MAX; j+=2)
    {
        if(!is_prime[j])
        {
            prime[k++]=j;
        }
    }
}

long NOD(long n)
{
    int  i,j,k;
    long sq=sqrt(n);
    long res=1;
    for(i=0; prime[i]<=sq; i++)
    {
        int cnt=1;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                cnt++;
                n=n/prime[i];
                if(n==1) break;
            }
            res*=cnt;
            sq=sqrt(n);
        }
    }
    if(n>1) res*=2;
    return res;
}
*/

int main()
{
    // FILE * fin, * fout;
    // fin=fopen("input.txt","r");
    // fout=fopen("output.txt","w");

    int i,j,k;
    int op,n;
    LL a,b;
    LL arr1[101],arr2[101];
    cin>>n;
    k=0;
    loop(n)
    {
        cin>>op>>a>>b;
        if(op==1)
        {
            arr1[k]=a;
            arr2[k]=b;
            k++;
        }
        else
        {
            LL low=arr1[a-1];
            LL high=arr2[a-1];
            bool c=1;
            loop(k+5)
            {
                for(i=0; i<k; i++)
                {
                    if(arr1[i]<low && arr2[i]>low)
                    {
                        low=min(low,arr1[i]);
                    }
                    if(arr1[i]<high && arr2[i]>high)
                    {
                        high=max(high,arr2[i]);
                    }
                }
                //cout<<low<<" "<<high<<endl;
                LL lowa=low;
                LL higha=high;
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                {
                    cout<<"YES"<<endl;
                    c=0;
                }
            }
            if(c)
            {
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                    cout<<"YES"<<endl;
                else if((low<arr1[b-1] && arr1[b-1]<high) || (low<arr2[b-1] && arr2[b-1]<high))
                    cout<<"YES"<<endl;
                else
                    cout<<"NO"<<endl;
            }

        }
    }

    return 0;
}


#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <climits>

/**********TYPE CASTING**********/
#define LL long long
#define L long
#define D double
#define LD long double
#define S string
#define I int
#define ULL unsigned long long
#define q queue<int>
#define vi vector<int>
#define vl vector<long>

/**********INPUT**********/
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%ld",&a)
#define s1(a) scanf("%d",&a)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",&a)
#define gc() getchar()

/**********OUTPUT**********/
#define p1(a) printf("%d\n",a)
#define p2(a,b) printf("%d %d\n",a,b)
#define pll(a) printf("%lld\n",a)
#define pd(a) printf("%.10lf\n",a)
#define pcs(a,n) printf("Case %d: %d\n",a,n)
#define nl() printf("\n")

/**********LOOP**********/
#define REV(i,e,s) for(i=e;i>=s;i--)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define loop(n) for(int o=1;o<=n;o++)

/********** min/max *******/
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) mix(a,max(b,c))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))

/**********SHORTCUT**********/
#define len(a) a.length()
#define SET(a,x) memset(a,x,sizeof a)
#define VI vector<int>
#define PB push_back
#define SZ size()
#define CLR clear()
#define PB(A) push_back(A)
#define clr(a,b) memset(a,b,sizeof(a))

/**********CONSTANT**********/
#define MIN INT_MIN
#define PI 2acos(-1.0)
#define INF 2<<15
#define MOD 1000000007
#define MAX 1000001

using namespace std;

/*

LL gcd(LL a,LL b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}

LL bigmod(LL p,LL e,LL M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        LL t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}

LL modinverse(LL a,LL M)
{
    return bigmod(a,M-2,M);
}

bool is_prime[MAX];
L prime[MAX];

bool sieve()
{
    long i,j;
    prime[0]=2;
    int k=1;
    int sq=(sqrt(MAX));
    for(i=3; i<=sq; i+=2)
    {
        if(!is_prime[i])
        {
            for(j=i*i; j<=MAX; j+=(2*i))
                is_prime[j]=1;
        }
    }
    for(j=3; j<=MAX; j+=2)
    {
        if(!is_prime[j])
        {
            prime[k++]=j;
        }
    }
}

long NOD(long n)
{
    int  i,j,k;
    long sq=sqrt(n);
    long res=1;
    for(i=0; prime[i]<=sq; i++)
    {
        int cnt=1;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
                cnt++;
                n=n/prime[i];
                if(n==1) break;
            }
            res*=cnt;
            sq=sqrt(n);
        }
    }
    if(n>1) res*=2;
    return res;
}
*/

int main()
{
    // FILE * fin, * fout;
    // fin=fopen("input.txt","r");
    // fout=fopen("output.txt","w");

    int i,j,k;
    int op,n;
    LL a,b;
    LL arr1[101],arr2[101];
    cin>>n;
    k=0;
    loop(n)
    {
        cin>>op>>a>>b;
        if(op==1)
        {
            arr1[k]=a;
            arr2[k]=b;
            k++;
        }
        else
        {
            LL low=arr1[a-1];
            LL high=arr2[a-1];
            bool c=1;
            loop(k)
            {
                for(i=0; i<k; i++)
                {
                    if(arr1[i]<low && arr2[i]>low)
                    {
                        low=min(low,arr1[i]);
                    }
                    if(arr1[i]<high && arr2[i]>high)
                    {
                        high=max(high,arr2[i]);
                    }
                }
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }
                else if((low<arr1[b-1] && arr1[b-1]<high) || (low<arr2[b-1] && arr2[b-1]<high))
                {
                    cout<<"YES"<<endl;
                    c=0;
                    break;
                }
            }
            if(c)
            {
                if((arr1[b-1]<low && low<arr2[b-1]) || (arr1[b-1]<high && high<arr2[b-1]))
                    cout<<"YES"<<endl;
                else if((low<arr1[b-1] && arr1[b-1]<high) || (low<arr2[b-1] && arr2[b-1]<high))
                    cout<<"YES"<<endl;
                else
                    cout<<"NO"<<endl;
            }

        }
    }

    return 0;
}


#include <iostream>
using namespace std;

int input[111][2], pos = 0;
bool usado[111];

void dfs (int v){
    usado[v] = true;
    for (int i = 0; i < pos; i++)
        if (!usado[i] && ((input[i][0] < input[v][0] && input[v][0] < input[i][1])||(input[i][0] < input[v][1] && input[v][1] < input[i][1]))) return dfs(i);
}

int main(){
    int n, a, b, op;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> op;
        if (op == 1){
            cin >> input[pos][0] >> input[pos][1];
            pos++;
        }
        else {
            for (int i = 0; i < 111; i++) usado[i] = false;
            cin >> a >> b;
            a--; b--;
            dfs(a);
            if (usado[b]) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }

    return 0;
}


#include <iostream>
using namespace std;

int input[111][2], pos = 0;
bool usado[111];

void dfs (int v){
    usado[v] = true;
    for (int i = 0; i < pos; i++)
        if (!usado[i] && ((input[i][0] < input[v][0] && input[v][0] < input[i][1])||(input[i][0] < input[v][1] && input[v][1] < input[i][1]))) dfs(i);
}

int main(){
    int n, a, b, op;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> op;
        if (op == 1){
            cin >> input[pos][0] >> input[pos][1];
            pos++;
        }
        else {
            for (int j = 0; j < 111; j++) usado[j] = false;
            cin >> a >> b;
            dfs(a-1);
            if (usado[b-1]) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }

    return 0;
}


#include <iostream>
using namespace std;

int input[111][2], pos = 0;
bool usado[111];

void dfs (int v){
    usado[v] = true;
    for (int i = 0; i < pos; i++)
        if (!usado[i] && ((input[i][0] < input[v][0] && input[v][0] < input[i][1])||(input[i][0] < input[v][1] && input[v][1] < input[i][1]))) dfs(i);
}

int main(){
    int n, a, b, op;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> op;
        if (op == 1){
            cin >> input[pos][0] >> input[pos][1];
            pos++;
        }
        else {
            for (int j = 0; j < 111; j++) usado[j] = false;
            cin >> a >> b;
            dfs(a-1);
            cout << endl;
            if (usado[b-1]) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }

    return 0;
}


#include <iostream>
using namespace std;

typedef long long int tint;

tint entrada[111][3];
bool usado[111];
tint n;
tint pos = 0;

bool dfs (tint v, tint d){
    if (v == d) return 1;
    for (tint i = 0; i < pos; i++){
        if (!usado[i] && ((entrada[i][1] < entrada[v][1] && entrada[v][1] < entrada[i][2])||(entrada[i][1] < entrada[v][2] && entrada[v][2] < entrada[i][2]))){
            usado[i] = true;
            if (dfs(i, d)) return 1;
            usado[i] = false;
        }
    }
    return 0;
}

int main(){
    tint operation, a, b;
    cin >> n;
    for (tint i = 0; i < n; i++) {
        cin >> operation;
        if (operation == 2){
            cin >> a >> b;
            for (tint i = 0; i < n; i++) usado[i] = false;
            if (dfs(a-1, b-1)) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
        else {cin >> entrada[pos][1] >> entrada[pos][2]; pos++;}
    }

    return 0;
}


#include <iostream>
using namespace std;

int input[111][2], pos = 0;
bool usado[111];

void dfs (int v){
    usado[v] = true;
    cout << v+1 << " ";
    for (int i = 0; i < pos; i++)
        if (!usado[i] && ((input[i][0] < input[v][0] && input[v][0] < input[i][1])||(input[i][0] < input[v][1] && input[v][1] < input[i][1]))) dfs(i);
}

int main(){
    int n, a, b, op;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> op;
        if (op == 1){
            cin >> input[pos][0] >> input[pos][1];
            pos++;
        }
        else {
            for (int j = 0; j < 111; j++) usado[j] = false;
            cin >> a >> b;
            dfs(a-1);
            cout << endl;
            if (usado[b-1]) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }

    return 0;
}


#include <iostream>
#include <vector>
using namespace std;

typedef long long int tint;

tint n;
vector <bool> usado;
bool llega = false;
void dfs (tint v, tint d, vector <vector <tint> > input, int pos){
    for (tint i = 0; i < pos; i++){
        if (input[i][0] == 1 && !usado[i] && ((input[i][1] < input[v][1] && input[v][1] < input[i][2]) || (input[i][1] < input[v][2] && input[v][2] < input[i][2]))){
            if (i == d){cout << "YES" << endl; llega = true;}
            usado[i] = true;
            dfs(i, d, input, pos);
            usado[i] = false;
        }
    }
}

int main(){
    cin >> n;
    vector <vector <tint> > input (n, vector <tint> (3));
    for (tint i = 0; i < n; i++) {
            cin >> input[i][0] >> input[i][1] >> input[i][2];
            usado.push_back(false);
            if (input[i][0] == 2){
                    llega = false;
                    dfs(input[i][1]-1, input[i][2]-1, input, i);
                    if (!llega) cout << "NO" << endl;
            }
    }

    return 0;
}


#include <iostream>
#include <vector>
using namespace std;

typedef long long int tint;

tint n;
vector <bool> usado;
bool llega = false;
void dfs (tint v, tint d, vector <vector <tint> > input, int pos){
    for (tint i = 0; i < pos; i++){
        if (input[i][0] == 1 && !usado[i] && ((input[i][1] < input[v][1] && input[v][1] < input[i][2]) || (input[i][1] < input[v][2] && input[v][2] < input[i][2]))){
            if (i == d && !llega){cout << "YES" << endl; llega = true;}
            usado[i] = true;
            dfs(i, d, input, pos);
            usado[i] = false;
        }
    }
}

int main(){
    cin >> n;
    vector <vector <tint> > input (n, vector <tint> (3));
    for (tint i = 0; i < n; i++) {
            cin >> input[i][0] >> input[i][1] >> input[i][2];
            usado.push_back(false);
            if (input[i][0] == 2){
                    llega = false;
                    dfs(input[i][1]-1, input[i][2]-1, input, i);
                    if (!llega) cout << "NO" << endl;
            }
    }

    return 0;
}


#include <iostream>
using namespace std;

typedef long long int tint;

tint entrada[111][3];
bool usado[111];
tint n;
tint pos;

bool dfs (tint v, tint d){
    if (v == d) return 1;
    for (tint i = 0; i < pos; i++){
        if (!usado[i] && ((entrada[i][1] < entrada[v][1] && entrada[v][1] < entrada[i][2])||(entrada[i][1] < entrada[v][2] && entrada[v][2] < entrada[i][2]))){
            usado[i] = true;
            if (dfs(i, d)) return 1;
            usado[i] = false;
        }
    }
    return 0;
}

int main(){
    tint a, b, c;
    cin >> n;
    for (tint i = 0; i < n; i++) {
        cin >> a >> b >> c;
        if (a == 2){
            for (tint j = 0; j < n; j++) usado[j] = false;
            if (dfs(b-1, c-1)) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
        else {entrada[pos][0] = a; entrada[pos][1] = b; entrada[pos][2] = c; pos++;}
    }

    return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
int n;
int cnt;
int map_[110][110];
class node
{
public:
    int x,y;
};
int n1,n2;
node no[110];
bool dfs(int n)
{
    if(map_[n][n2]==1) return true;
    for(int i=1; i<=cnt; i++)
        if(map_[n][i]) return map_[i][n2]=dfs(i);
    return false;
}
void g()
{
    for(int i=1;i<=cnt;i++)
    {
        for(int j=1;j<=cnt;j++)
            cout<<map_[i][j];
        cout<<endl;
    }
}
int main()
{
    scanf("%d",&n);
    while(n--)
    {
        int t;
        scanf("%d",&t);
        if(t==1)
        {
            int x,y;
            scanf("%ld%ld",&x,&y);
            no[++cnt].x=x;
            no[cnt].y=y;
            for(int i=1; i<cnt; i++)
            {
                if((no[i].x<y && no[i].x>x)||(no[i].y<y && no[i].y>x))
                    map_[i][cnt]=1;
                if((no[i].x<y && no[i].y>y)||(no[i].x<x && no[i].y>x))
                    map_[cnt][i]=1;

            }
        }
        else
        {

            scanf("%d%d",&n1,&n2);
            if(dfs(n1))
            {
                map_[n1][n2]=1;
                printf("YES\n");
            }

            else
                printf("NO\n");
        }

    }
    return 0;
}


#include<iostream>
#include<string.h>
using namespace std;
int ans;
struct Point{
   int left;
   int right;
}p[110];
bool vis[110];
bool judge(int a,int b)
{
    if(p[a].left>p[b].left && p[a].left<p[b].right){
        return true;
    }
    if(p[a].right>p[b].left && p[a].right<p[b].right){
        return true;
    }
    return false;
}
bool dfs(int x, int y)
{
    if(x == y)
    {
        return true;
    }
    vis[x]=true;
    for(int i=1;i<=ans;i++){
        if(!vis[i])
            if(judge(x,i)&&dfs(i,y))
                return true;
    }
    return false;
}
int main(){
    int T;
    int r1,r2,r3;
    cin>>T;
    ans=1;
    while(T--){
        cin>>r1>>r2>>r3;
        if(r1==1){
            p[ans].left=r2;
            p[ans].right=r3;
            ans++;
        }
        else if(r1==2)
        {
            memset(vis,false,sizeof(vis));
            if(dfs(r2,r3))
                cout<<"YES"<<endl;
            else
                cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

const int MAXN = 102;
int a[MAXN], b[MAXN];
bool f[MAXN];
int n, cnt;

void dfs(int s, int e)
{
    f[s]=1;
    if(f[e]) return ;
    for(int i=1; i<cnt; i++)
    {
        if(f[i]) continue;
        if(a[s]>a[i]&&a[s]<b[i]) dfs(i, e);
        if(f[e]) return ;
        if(b[s]>a[i]&&b[s]<b[i]) dfs(i, e);
        if(f[e]) return ;
    }
}

int main()
{
    while(scanf("%d",&n)!=EOF)
    {
        cnt=1;
        int m,x,y;
        while(n--)
        {
            scanf("%d",&m);
            if(m==1)
            {
                scanf("%d %d",&a[cnt],&b[cnt]);
                cnt++;
            }
            else
            {
                scanf("%d %d",&x,&y);
                memset(f, 0, sizeof(f));
                dfs(x,y);
                if(f[y]) puts("YES");
                else puts("NO");
            }
        }
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int n;
int cnt;

class node
{
public:
    int x,y;
};
int n1,n2;
node no[110];
int vis[110];
bool check(int a,int b)
{
    if((no[a].x>no[b].x && no[a].x<no[b].y)||(no[a].y>no[b].x && no[a].y<no[b].y))
        return true;

    return false;

}
bool dfs(int n,int m)
{
    if(n==m) return true;
    for(int i=1; i<cnt; i++)
        if(check(n,i) && !vis[i])
        {
            vis[i]=1;
            if(dfs(i,m)==1) return true;
        }
    return false;
}
int main()
{
    while(~scanf("%d",&n))
    {
        cnt=1;
        for(int t=0;t<n;t++)
        {
            int k;
            scanf("%d",&k);
            if(k==1)
            {
                int x,y;
                scanf("%d%d",&x,&y);
                no[cnt++].x=x;
                no[cnt].y=y;

            }
            else
            {
                scanf("%d%d",&n1,&n2);
                memset(vis,0,sizeof vis);
                vis[n1]=1;
                if(dfs(n1,n2))
                {
                    printf("YES\n");
                }
                else
                    printf("NO\n");
            }
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

struct Interval
{
    int left,right;
};
Interval P[110];
int sum;
bool visit[110];

bool Check(int a,int b)
{
    if (P[a].left > P[b].left && P[a].left < P[b].right)
        return true;
    else if (P[a].right > P[b].left && P[a].right < P[b].right)
        return true;
    return false;
}
bool Dfs(int now,int ends)
{
    if (now == ends)
        return true;
    int i;
    for (i=1;i<sum;i++)
    {
        if (Check(now,i)&&!visit[i])
        {
            visit[i] = true;
            if (Dfs(i,ends))
                return true;
        }
    }
    return false;
}
int main()
{
    int n,i;
    cin>>n;
    sum=1;
    for (i=0;i<n;i++)
    {
        int num;
        cin>>num;
        if (num==1)
        {
            scanf("%d %d",&P[sum].left,&P[sum].right);
            sum++;
        }
        else
        {
            int a,b,j;
            cin>>a>>b;
            for (j=1;j<sum;j++)
            {
                visit[j]=false;
            }
            visit[a]=true;
            if (Dfs(a,b))
                cout<<"YES"<<endl;
            else
                cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>   //memset    string编译可以 但是会CE
using namespace std;
int maps[105][105] = {0};
int vis[105] = {0};
int goal;
int N;
struct intervel
{
    int l,r;
};
intervel in[105];
void DFS(int num1){
    if(goal == num1) {return ;}
    for(int i = 1;i<N;i++){
        if(maps[num1][i] && !vis[i]){
            vis[i] = 1;//cout<<"now"<<num1<<" -> "<<i<<endl;
            DFS(i);
        }
    }
    return ;
}
int main()
{
    int ca;
    int no = 1;
    scanf("%d",&ca);
    while(ca--){
        int type,num1,num2;
        scanf("%d %d %d",&type,&num1,&num2);

        if(type == 1){
            in[no].l = num1;
            in[no].r = num2;

            for(int i = 1;i<=no;i++){
                if( ((in[i].l < in[no].l && in[no].l < in[i].r) && (  in[i].r <= in[no].r ) )||( (in[i].l < in[no].r && in[no].r < in[i].r) && (  in[no].l <= in[i].l ) )){
                    maps[no][i] = 1;//cout<<"union"<<no<<" -> "<<i<<endl;
                }
                 if ( ((in[no].l < in[i].l && in[i].l < in[no].r) && (  in[no].r <= in[i].r ) )||( (in[no].l < in[i].r && in[i].r < in[no].r) && (  in[i].l <= in[no].l ) )){
                    maps[i][no] = 1;//cout<<"union"<<i<<" -> "<<no<<endl;
                }
               /*  if(in[no].l < in[i].l && in[i].l < in[no].r && in[no].l < in[i].r && in[i].r < in[no].r){
                    maps[i][no] = 1;
                }
                 if(in[i].l < in[no].l && in[no].l < in[i].r && in[i].l < in[no].r && in[no].r < in[i].r){
                    maps[no][i] = 1;
                } */
            }

            no++;
        }
        else{
            N = no;
            vis[num1] = 1;
            goal = num2;
            DFS(num1);
            if(vis[goal] == 1)
                printf("YES\n");
            else
                printf("NO\n");
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#define MAX 110
using namespace std;

struct Interval {
    int a,b;
    Interval(int u,int v) {
        a=u;
        b=v;
    }
    bool judge(Interval x)
    {
         if((a<x.a&&x.a<b)||(a<x.b&&x.b<b)) return true;
         else return false;
    }
};
vector<Interval> in;
int table[MAX][MAX];
int t,choice;

bool dfs(int u,int v) {
     if(table[u][v]) return true;
     for(int i=0;i<in.size();i++) {
         if(i==u) continue;
         if(table[u][i]) {
             return dfs(i,v);
         }
     }
     return false;
}

void compute() {
     memset(table,0,sizeof(table));
     cin>>t;
     while(t--)
     {
         scanf("%d",&choice);
         if(choice == 1)
         {
             int x,y;
             scanf("%d%d",&x,&y);
             in.push_back(Interval(x,y));
         }
         if(choice == 2)
         {
             for(int i=0;i<in.size();i++)
                 for(int j=0;j<in.size();j++)
                 {
                     if(in[i].judge(in[j])) table[i][j]=1;
                 }
             int a,b;
             scanf("%d%d",&a,&b);
             if(dfs(a,b)) cout<<"YES"<<endl;
             else cout<<"NO"<<endl;
         }
     }
}
int main() {
    compute();
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define INF 1e9
#define ms(a,val) memset((a),(val),(sizeof(a)))
#pragma comment(linker, "/STACK:102400000,102400000")

using namespace std;

ll G[105][105];
struct node{
    int l,r;
    node(){};
    node(int l,int r):l(l),r(r){};
}ins[105];
int main() {
    int n,oper,l,r,cal,qcal;
    while(~scanf("%d",&n)){
        ms(G,0);
        cal=0,qcal=0;
        for(int i=0;i<n;i++){
            scanf("%d%d%d",&oper,&l,&r);
            if(oper==1){
                ins[++cal]=node(l,r);
                for(int i=1;i<cal;i++){
                    if((ins[i].l<l&&ins[i].r>l)||(ins[i].l<r&&ins[i].r>r))G[cal][i]=1;
                    if((l<ins[i].l&&r>ins[i].l)||(l<ins[i].r&&r>ins[i].r))G[i][cal]=1;
                }
            }
            else{
                for(int i=1;i<=cal;i++){
                    for(int j=1;j<=cal;j++){
                        for(int k=1;k<=cal;k++){
                            if(G[j][i]&&G[i][k])G[j][k]=1;
                        }
                    }
                }
                if(G[l][r]==1)printf("YES\n");
                else printf("NO\n");
            }
        }
    }
	return 0;
}


#include <iostream>
#include <string.h>
using namespace std;
struct point
{
    int x,y;
}Point[105];
int vis[105],counts;
int flag;
void dfs(int t,int s)
{
    if(t==s)
    {
        flag=1;
        return;
    }
    vis[t]=1;
    for(int i=1;i<counts;i++)
    {
        if(!vis[i]&&((Point[i].x<Point[t].x&&Point[t].x<Point[i].y)||(Point[i].x<Point[t].y&&Point[t].y<Point[i].y)))
        {
            dfs(i,s);
        }
    }
    return;
}
int main()
{
    int N,x1,y1,c;
    counts=1;
    cin>>N;
    memset(vis,0,sizeof(vis));
    while(N--)
    {
        cin >> c >> x1 >> y1;
        if(c==1)
        {
            Point[counts].x=x1;
            Point[counts].y=y1;
            /*for(int i=1;i<counts;i++)
            {
                if((Point[i].x<Point[counts].x&&Point[counts].x<Point[i].y)||(Point[i].x<Point[counts].y&&Point[counts].y<Point[i].y))
                {
                    maps[counts][i]=1;
                }
                if((Point[counts].x<Point[i].x&&Point[i].x<Point[counts].y)||(Point[counts].x<Point[i].y&&Point[i].y<Point[counts].y))
                {
                    maps[i][counts]=1;
                }
            }*/
            counts++;
        }
        else if(c==2)
        {
            memset(vis,0,sizeof(vis));
            flag=0;
            dfs(x1,y1);
            if(flag==1)
            {
                cout << "YES" <<endl;
            }
            else
                cout << "NO" <<endl;
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>

using namespace std;

struct interval
{
    int a,b;
};

interval path[110];
int father[110],vis[110];
vector<int> route[110];
bool flag=false;

void init()
{
    flag=false;
    for(int i=0;i<105;i++)
        route[i].clear();
    memset(vis,0,sizeof(vis));
}

bool judge(int i,int j)
{
    if(path[i].a<path[j].b&&path[i].a>path[j].a)
        return true;
    if(path[i].b>path[j].a&&path[i].b<path[j].b)
        return true;
    return false;
}

void dfs(int a,int b)
{
    int i;
    if(a==b){
        flag=true;
        return;
    }
    for(i=0;i<route[a].size();i++){
        int k=route[a][i];
        if(!vis[k])
            dfs(k,b);
    }
    return;
}

int main()
{
    int n;
    while(cin>>n){
        int cnt=0,i,j,k;
        init();
        for(i=0;i<n;i++){
            int t,a,b;
            scanf("%d%d%d",&t,&a,&b);
            if(t==1){
                path[cnt].a=a;
                path[cnt++].b=b;
            }
            else{
                for(j=0;j<cnt;j++)
                    for(k=j+1;k<cnt;k++){
                        if(judge(j,k))
                           route[j].push_back(k);
                        if(judge(k,j))
                           route[k].push_back(j);
                    }
                dfs(a,b);
                if(flag==true)cout<<"YES"<<endl;
                else cout<<"NO"<<endl;
                flag=false;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node{
	int u,v;
}e[101];
int v[101];
int num=0;
bool check(int x,int y){
    int a = e[x].u,b = e[x].v;
    int c = e[y].u,d = e[y].v;
    if((c < a && a < d) || (c < b && b < d))
        return true;
    return false;
}
void dfs(int x,int y){
	if(v[x] || v[y]) return;
    v[x] = 1;
    for(int i = 0;i < num;i++){
        if(!v[i] && check(x,i))
            dfs(i,y);
    }
}
int main(){
	int n;
    cin >> n;
    int c,x,y;
    while(n--){
        scanf("%d%d%d",&c,&x,&y);
        if(c == 1){
            e[num].u = x;
            e[num].v = y;
            num++;
        }
        else{
            memset(v,0,sizeof(v));
            dfs(x-1,y-1);
            if(v[y-1])
                printf("YES\n");
            else
                printf("NO\n");
        }
	}
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

const int MAX=105;
int a[MAX],b[MAX];
bool c[MAX];
int n,cnt;

void dfs(int v, int e)
{
    c[v]=1;
    if(c[e]==1)
        return ;
    for(int i=1; i<cnt; i++)
    {
        if(c[i]==1) continue;
        if(a[v]>a[i]&&a[v]<b[i]) dfs(i,e);
        if(c[e]==1) return ;
        if(b[v]>a[i]&&b[v]<b[i]) dfs(i,e);
        if(c[e]==1) return ;
    }
}
int main()
{
    while(scanf("%d",&n)!=EOF)
    {
        cnt=1;
        int m,x,y;
        while(n--)
        {
            scanf("%d",&m);
            if(m!=1)
            {
                scanf("%d %d",&x,&y);
                memset(c, 0, sizeof(c));
                dfs(x,y);
                if(c[y])
                    cout<<"YES"<<ends<<ends;
                else
                    cout<<"NO"<<ends<<ends;
            }
            else
            {
                scanf("%d %d",&a[cnt],&b[cnt]);
                cnt++;
            }
        }
    }
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
struct Node
{
	int x,y;
	Node(int a,int b)
	{
		x=a;
		y=b;
	}
};
int fa[110];
vector <Node> node;
int finding(int x)
{
	int r=x;
	while(fa[r]!=r)
	{
		r=fa[r];
	}
}

int main()
{
	int n,ch,x,y;
	int i,j,tot;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	fa[i]=i;
	node.clear();
	tot=0;
	while(n--)
	{
		cin>>ch;
		if(ch==1)
		{
			cin>>x>>y;
			for(i=0;i<node.size();i++)
			{
				if((x>node[i].x&&x<node[i].y)||(y>node[i].x&&y<node[i].y))
				{
					int f=finding(i);
					fa[i]=tot;
				}
			}
			node.push_back(Node(x,y));
			tot++;
		}
		else
		{
			cin>>x>>y;
			/*for(i=0;i<node.size();i++)
			{
				cout<<fa[i]<<endl;
			}*/
			int fa=finding(x-1);
			int fb=finding(y-1);
			if(fa==fb&&fa!=-1)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
		}
	}
	return 0;
}