import javax.swing.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static long[] tree;
    static int m = 100000000;
    static int k1,k2;
    static int[] p;
    static tuple[] tuples;
    public static void main(String[] args) throws IOException {
        //BufferedReader reader=new BufferedReader(new FileReader("input.txt"));
        //PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //Scanner sc=new Scanner(System.in);
        Reader sc = new Reader();

        int n=sc.nextInt();
        int[] p=new int[101];
        for (int i = 0; i <p.length ; i++) {
            p[i]=i;
        }
        tuple[] tuples=new tuple[101];
        int k=0;
        sc.nextInt();
        tuples[k++]=new tuple(sc.nextInt(),sc.nextInt());
        for (int i = 1; i <n ; i++) {
            int q=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
            if (q==1){
                tuples[k]=new tuple(x,y);
                for (int j = k-1; j >-1 ; j--) {
                    if ((tuples[j].a<x && x<tuples[j].b)||
                            (tuples[j].a<y && y<tuples[j].b)){
                        union(p,k,j);

                    }
                }
                k++;
            }
            else {
                if (find(p,x-1)==find(p,y-1)){
                    out.println("YES");
                }else
                    out.println("NO");
            }
        }
        System.out.println(Arrays.toString(tuples));
        System.out.println(Arrays.toString(p));

        out.close();
    }
    static int find(int[] p,int x){
        if (p[x]==x)return x;

        return p[x]=find(p,p[x]);
    }
    static void union(int[] p,int a,int b){
        p[find(p,b)]=find(p,a);
    }
    static void built(long[] a,int at,int l,int r,int n){
        if (l==r){
            tree[at]=a[l];
        }
        else {
            int mid=(l+r)/2;
            int right=2*at;
            int left=(2*at)+1;
            built(a,left,l,mid,n-1);
            built(a,right,mid+1,r,n-1);
            if (n%2==0)
                tree[at]=tree[left]^tree[right];
            else
                tree[at]=tree[left]|tree[right];
        }
    }
    static void update(int at,int l,int r,int i,long v,int n){
        if (i<l || i>r)return;

        if (l==r){
            tree[at]=v;
        }
        else {
            int mid=(l+r)/2;
            int right=2*at;
            int left=(2*at)+1;
            update(left,l,mid,i,v,n-1);
            update(right,mid+1,r,i,v,n-1);
            if (n%2==0)
                tree[at]=tree[left]^tree[right];
            else
                tree[at]=tree[left]|tree[right];
        }
    }

}

    class node implements Comparable<node> {
        Integer no;
        Integer cost;
        Vector<node> adj = new Vector<>();

        public node(Integer no, Integer cost) {
            this.no = no;
            this.cost = cost;
        }

        @Override
        public String toString() {
            return "node{" +
                    "no=" + no +
                    ", cost=" + cost +
                    '}';
        }

        @Override
        public int compareTo(node o) {
            return o.cost - this.cost;
        }
    }

    class edge implements Comparable<edge> {
        tuple u;
        Double cost;

        public edge(tuple u, Double cost) {
            this.u = u;
            this.cost = cost;
        }

        @Override
        public int compareTo(edge o) {
            return this.cost.compareTo(o.cost);
        }

        @Override
        public String toString() {
            return "edge{" +
                    "u=" + u +
                    ", cost=" + cost +
                    '}';
        }
    }

    ///*
    class tuple implements Comparable<tuple> {
        Integer a;
        Integer b;

        public tuple(Integer a, Integer b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(tuple o) {
            return (int) (this.b - o.b);
        }

        @Override
        public String toString() {
            return "tuple{" +
                    "a=" + a +
                    ", b=" + b +
                    '}';
        }
    }

    //*/
    class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }


import javax.swing.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static long[] tree;
    static int m = 100000000;
    static int k1,k2;
    static int[] p;
    static tuple[] tuples;
    public static void main(String[] args) throws IOException {
        //BufferedReader reader=new BufferedReader(new FileReader("input.txt"));
        //PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //Scanner sc=new Scanner(System.in);
        Reader sc = new Reader();

        int n=sc.nextInt();
        int[] p=new int[101];
        for (int i = 0; i <p.length ; i++) {
            p[i]=i;
        }
        tuple[] tuples=new tuple[101];
        int k=0;
        sc.nextInt();
        tuples[k++]=new tuple(sc.nextInt(),sc.nextInt());
        for (int i = 1; i <n ; i++) {
            int q=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
            if (q==1){
                tuples[k]=new tuple(x,y);
                for (int j = k-1; j >-1 ; j--) {
                    if ((tuples[j].a<x && x<tuples[j].b)||
                            (tuples[j].a<y && y<tuples[j].b)){
                        union(p,k,j);

                    }
                }
                k++;
            }
            else {
                if (find(p,x-1)==find(p,y-1)){
                    out.println("YES");
                }else
                    out.println("NO");
            }
        }
        //System.out.println(Arrays.toString(tuples));
        //System.out.println(Arrays.toString(p));

        out.close();
    }
    static int find(int[] p,int x){
        if (p[x]==x)return x;

        return p[x]=find(p,p[x]);
    }
    static void union(int[] p,int a,int b){
        p[find(p,b)]=find(p,a);
    }
    static void built(long[] a,int at,int l,int r,int n){
        if (l==r){
            tree[at]=a[l];
        }
        else {
            int mid=(l+r)/2;
            int right=2*at;
            int left=(2*at)+1;
            built(a,left,l,mid,n-1);
            built(a,right,mid+1,r,n-1);
            if (n%2==0)
                tree[at]=tree[left]^tree[right];
            else
                tree[at]=tree[left]|tree[right];
        }
    }
    static void update(int at,int l,int r,int i,long v,int n){
        if (i<l || i>r)return;

        if (l==r){
            tree[at]=v;
        }
        else {
            int mid=(l+r)/2;
            int right=2*at;
            int left=(2*at)+1;
            update(left,l,mid,i,v,n-1);
            update(right,mid+1,r,i,v,n-1);
            if (n%2==0)
                tree[at]=tree[left]^tree[right];
            else
                tree[at]=tree[left]|tree[right];
        }
    }

}

    class node implements Comparable<node> {
        Integer no;
        Integer cost;
        Vector<node> adj = new Vector<>();

        public node(Integer no, Integer cost) {
            this.no = no;
            this.cost = cost;
        }

        @Override
        public String toString() {
            return "node{" +
                    "no=" + no +
                    ", cost=" + cost +
                    '}';
        }

        @Override
        public int compareTo(node o) {
            return o.cost - this.cost;
        }
    }

    class edge implements Comparable<edge> {
        tuple u;
        Double cost;

        public edge(tuple u, Double cost) {
            this.u = u;
            this.cost = cost;
        }

        @Override
        public int compareTo(edge o) {
            return this.cost.compareTo(o.cost);
        }

        @Override
        public String toString() {
            return "edge{" +
                    "u=" + u +
                    ", cost=" + cost +
                    '}';
        }
    }

    ///*
    class tuple implements Comparable<tuple> {
        Integer a;
        Integer b;

        public tuple(Integer a, Integer b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(tuple o) {
            return (int) (this.b - o.b);
        }

        @Override
        public String toString() {
            return "tuple{" +
                    "a=" + a +
                    ", b=" + b +
                    '}';
        }
    }

    //*/
    class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }


import javax.swing.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static long[] tree;
    static int m = 100000000;
    static int k1,k2;
    static boolean[] vis;
    static tuple[] tuples;
    public static void main(String[] args) throws IOException {
        //BufferedReader reader=new BufferedReader(new FileReader("input.txt"));
        //PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //Scanner sc=new Scanner(System.in);
        Reader sc = new Reader();

        int n=sc.nextInt();
        vis=new boolean[101];
        tuples=new tuple[101];
        k1=0;
        for (int i = 0; i <n ; i++) {
            int q=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
            if (q==1){
                tuples[k1++]=new tuple(x,y);
            }
            else {
                if (bfs(x-1,y-1)){
                    out.println("YES");
                }
                else
                    out.println("NO");
            }
        }

        out.close();
    }
    static boolean bfs(int a,int b){
        Queue<Integer> queue=new LinkedList<>();
        queue.add(a);

        while (!queue.isEmpty()){
            int now=queue.poll();
            vis[now]=true;

            for (int i = 0; i <k1 ; i++) {
                if (!vis[i]){
                    if((tuples[i].a<tuples[now].a&&tuples[now].a<tuples[i].b)
                                ||(tuples[i].a<tuples[now].b&&tuples[now].b<tuples[i].b)){
                        queue.add(i);
                        if (i==b){
                            Arrays.fill(vis,false);
                            return true;
                        }
                    }
                }
            }
        }

        Arrays.fill(vis,false);
        return false;

    }
    static int find(int[] p,int x){
        if (p[x]==x)return x;

        return p[x]=find(p,p[x]);
    }
    static void union(int[] p,int a,int b){
        p[find(p,b)]=find(p,a);
    }
    static void built(long[] a,int at,int l,int r,int n){
        if (l==r){
            tree[at]=a[l];
        }
        else {
            int mid=(l+r)/2;
            int right=2*at;
            int left=(2*at)+1;
            built(a,left,l,mid,n-1);
            built(a,right,mid+1,r,n-1);
            if (n%2==0)
                tree[at]=tree[left]^tree[right];
            else
                tree[at]=tree[left]|tree[right];
        }
    }
    static void update(int at,int l,int r,int i,long v,int n){
        if (i<l || i>r)return;

        if (l==r){
            tree[at]=v;
        }
        else {
            int mid=(l+r)/2;
            int right=2*at;
            int left=(2*at)+1;
            update(left,l,mid,i,v,n-1);
            update(right,mid+1,r,i,v,n-1);
            if (n%2==0)
                tree[at]=tree[left]^tree[right];
            else
                tree[at]=tree[left]|tree[right];
        }
    }

}

    class node implements Comparable<node> {
        Integer no;
        Integer cost;
        Vector<node> adj = new Vector<>();

        public node(Integer no, Integer cost) {
            this.no = no;
            this.cost = cost;
        }

        @Override
        public String toString() {
            return "node{" +
                    "no=" + no +
                    ", cost=" + cost +
                    '}';
        }

        @Override
        public int compareTo(node o) {
            return o.cost - this.cost;
        }
    }

    class edge implements Comparable<edge> {
        tuple u;
        Double cost;

        public edge(tuple u, Double cost) {
            this.u = u;
            this.cost = cost;
        }

        @Override
        public int compareTo(edge o) {
            return this.cost.compareTo(o.cost);
        }

        @Override
        public String toString() {
            return "edge{" +
                    "u=" + u +
                    ", cost=" + cost +
                    '}';
        }
    }

    ///*
    class tuple implements Comparable<tuple> {
        Integer a;
        Integer b;

        public tuple(Integer a, Integer b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(tuple o) {
            return (int) (this.b - o.b);
        }

        @Override
        public String toString() {
            return "tuple{" +
                    "a=" + a +
                    ", b=" + b +
                    '}';
        }
    }

    //*/
    class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }


import java.io.*;
import java.util.*;

public class Test {

	static class Node
	{
		long x;
		long y;

		public Node (long v, long w)
		{
			x = v;
			y = w;
		}
	}

	public static void main (String[] args)
	{
		Scanner s = new Scanner (System.in);

		int n = s.nextInt();

		ArrayList<Node> intervals = new ArrayList<Node>();

		for (int i = 0; i<n; i++)
		{
			int q = s.nextInt();
			long src = s.nextLong();
			long dest = s.nextLong();

			if (q == 1)
				intervals.add(new Node (src, dest));
			else
			{
				boolean success = isPath(intervals.get((int)(src - 1)), intervals.get((int)(dest - 1)), intervals, new HashSet<Node>());
				if (success)
					System.out.println ("YES");

				else
					System.out.println ("NO");
			}
		}
	}

	public static boolean isPath (Node current, Node dest, ArrayList<Node> intervals, HashSet<Node> used)
	{
		if ((current.x > dest.x && current.x < dest.y) || (current.y > dest.x && current.y < dest.y))
			return true;

		if (used.contains(current))
			return false;

		boolean result = false;

		used.add(current);

		for (int i = 0; i < intervals.size(); i++)
		{
			Node next = intervals.get(i);
			if ((current.x > next.x && current.x < next.y) || (current.y > next.x && current.y < next.y))
				result = result || isPath(intervals.get(i), dest, intervals, used);
		}

		return result;
	}
}


import java.util.*;

public class PingPong {
	public static boolean[] DFS(int from, ArrayList<int[]> graph, boolean [] visited) {
		visited[from] = true;

		for(int i = 0; i < graph.size(); i++) {
			if(!visited[i]){
				if(graph.get(from)[0] > graph.get(i)[0] && graph.get(from)[0] < graph.get(i)[1]
						|| graph.get(from)[1] > graph.get(i)[0] && graph.get(from)[1] < graph.get(i)[1])
					DFS(i, graph, visited);
			}
		}
		return visited;
	}

	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int queries = kb.nextInt();
		ArrayList <int[]> graph = new ArrayList<int[]>();
		int count = 0;

		while(queries > 0) {
			int query = kb.nextInt();
			int from = kb.nextInt() - 1;
			int to = kb.nextInt() - 1;

			if(query == 1) {
				graph.add(count, new int[2]);
				graph.get(count)[0] = from;
				graph.get(count)[1] = to;
				count++;
			}
			else {
				boolean [] visited = new boolean [graph.size()];
				visited = DFS(from, graph, visited);
				if(visited[to])
					System.out.println("YES");
				else
					System.out.println("NO");
			}

			queries--;
		}
	}

}


import java.util.*;
import java.io.*;

public class B {
    private static boolean[] visited;
    private static List<Integer>[] adj;

    private static void dfs(int u){
        visited[u] = true;
        for(int v : adj[u]){
            if(!visited[v]) {
                dfs(v);
            }
        }
    }
    private static int link(Integer[] a, Integer[] b){
        if(a[0] > b[0] && a[1] < b[1]){
            return -1;
        }
        if(a[0] < b[0] && a[1] > b[1]){
            return 1;
        }
        if(!(a[0] >= b[1] || a[1] <= b[0])){
            return 2;
        }
        return 0;
    }
    public static void main(String[] args){
        FastScanner fs = new FastScanner(System.in);
        int n = fs.nextInt();
        List<Integer[]> segs = new ArrayList<>();
        adj = new ArrayList[n + 1];
        for(int q = 0; q < n; q++){
            int t, l, r;
            t = fs.nextInt();
            l = fs.nextInt();
            r = fs.nextInt();
            if(t == 1){
                Integer temp[] = new Integer[] {l, r};
                segs.add(temp);
                for(int idx = 0; idx < segs.size() - 1; idx++){
                    int edge = link(temp, segs.get(idx));
                    if(adj[idx] == null){
                        adj[idx] = new ArrayList<Integer>();
                    }
                    if(adj[segs.size() - 1] == null){
                        adj[segs.size() - 1] = new ArrayList<Integer>();
                    }
                    if(edge == -1){
                        //I'm skinny
                        adj[segs.size() - 1].add(idx);
                    } else if(edge == 1){
                        //I'm fat
                        adj[idx].add(segs.size() - 1);
                    } else if (edge == 2){
                        adj[idx].add(segs.size() - 1);
                        adj[segs.size() - 1].add(idx);
                    }
                }
            } else {
               visited = new boolean[n + 1];
               dfs(l - 1);
               if(visited[r - 1]){
                   System.out.println("YES");
               } else {
                   System.out.println("NO");
               }
            }
        }
    }
}

class FastScanner {
  private BufferedReader bf;
  private InputStreamReader read;

  //stream can be System.in, a FileInputStream, etc..
  public FastScanner(InputStream stream){
    read = new InputStreamReader(stream);
    bf = new BufferedReader(read);
  }
  /*
    Gives the next token in the buffer
  */
  public String next(){
    String res = "";
    try {
      int read = bf.read();
      //32 is whitespace, -1 EOF, 10 line feed
      while(read == 32 || read == 10){
        read = bf.read();
      }
      while(read != 10 && read != 32 && read != -1){
        res += Character.toString((char)read);
        read = bf.read();
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
    return res.trim();
  }

  public int nextInt() {
    return Integer.parseInt(next());
  }
  public long nextLong(){
    return Long.parseLong(next());
  }

  public boolean hasNext(){
    try {
      return bf.ready();
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }
  }

  public int[] getArrInt(int numToks){
    int res[] = new int[numToks];
      try {
        for(int idx = 0; idx < numToks; idx++){
          res[idx] = nextInt();
        }
        return res;
    } catch (Exception e){
      e.printStackTrace();
      return null;
    }
  }
}


import java.util.*;
import java.io.*;

public class B {
    public static void main(String[] args){
        FastScanner fs = new FastScanner(System.in);
        int n = fs.nextInt();
        List<Integer[]> segs = new ArrayList<>();
        DSU comps = new DSU(n + 1);
        for(int q = 0; q < n; q++){
            int t, l, r;
            t = fs.nextInt();
            l = fs.nextInt();
            r = fs.nextInt();
            if(t == 1){
                Integer temp[] = new Integer[] {l, r};
                segs.add(temp);
                for(int idx = 0; idx < segs.size() - 1; idx++){
                    if(!(segs.get(idx)[0] >= temp[1] || segs.get(idx)[1] <= temp[0])){
                        comps.merge(idx, segs.size() - 1);
                    }
                }
            } else {
                System.out.println(comps.find(l - 1) == comps.find(r - 1) ? "YES" : "NO");
            }
        }
    }
}

class FastScanner {
  private BufferedReader bf;
  private InputStreamReader read;

  //stream can be System.in, a FileInputStream, etc..
  public FastScanner(InputStream stream){
    read = new InputStreamReader(stream);
    bf = new BufferedReader(read);
  }
  /*
    Gives the next token in the buffer
  */
  public String next(){
    String res = "";
    try {
      int read = bf.read();
      //32 is whitespace, -1 EOF, 10 line feed
      while(read == 32 || read == 10){
        read = bf.read();
      }
      while(read != 10 && read != 32 && read != -1){
        res += Character.toString((char)read);
        read = bf.read();
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
    return res.trim();
  }

  public int nextInt() {
    return Integer.parseInt(next());
  }
  public long nextLong(){
    return Long.parseLong(next());
  }

  public boolean hasNext(){
    try {
      return bf.ready();
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }
  }

  public int[] getArrInt(int numToks){
    int res[] = new int[numToks];
      try {
        for(int idx = 0; idx < numToks; idx++){
          res[idx] = nextInt();
        }
        return res;
    } catch (Exception e){
      e.printStackTrace();
      return null;
    }
  }
}
class DSU {
  private int[] adj;
  private int[] maxes;
  private int[] sizes;

  public DSU(int size){
    adj = new int[size];
    maxes = new int[size];
    sizes = new int[size];
    for(int idx = 0; idx < size; idx++){
      adj[idx] = maxes[idx] = idx;
      sizes[idx] = 1;
    }
  }

  public int find(int idx){
    while(adj[idx] != idx){
      idx = adj[idx];
    }
    return idx;
  }

  public int getSize(int idx){
    return sizes[find(idx)];
  }

  public int getMax(int idx){
    return maxes[find(idx)];
  }

  public void merge(int a, int b){
    int aHead = find(a);
    int bHead = find(b);
    if(aHead == bHead){
      return;
    }
    if(sizes[bHead] > sizes[aHead]){
      adj[aHead] = bHead;
      maxes[bHead] = Math.max(maxes[aHead], maxes[bHead]);
      sizes[bHead] += sizes[aHead];
    } else {
      adj[bHead] = aHead;
      maxes[aHead] = Math.max(maxes[aHead], maxes[bHead]);
      sizes[aHead] += sizes[bHead];
    }
  }
  public String toString(){
    return Arrays.toString(adj);
  }
}


import java.awt.Point;
import java.io.*;
import java.util.*;

public class HelloWorld {
    static Point[] intervals;
    static int num = 0;

    public static boolean check(int ind1, int ind2) {
        return (intervals[ind1].x > intervals[ind2].x && intervals[ind1].x < intervals[ind2].y || intervals[ind1].y > intervals[ind2].x && intervals[ind1].y < intervals[ind2].y);
    }

    public static boolean bfs(int src, int dest) {
        Queue<Integer> queue = new LinkedList<Integer>();
        boolean[] visited = new boolean[100];
        queue.add(src);
        while (!queue.isEmpty()) {
            int ind = queue.remove();
            if (visited[ind]) continue;
            visited[ind] = true;
            if (check(ind, dest)) return true;
            for (int i = 0; i < num; i++) {
                if (!visited[i] && check(ind, i)) {
                    queue.add(i);
                }
            }
        }
        return false;
    }

    public static void main(String []args) throws IOException {

        intervals = new Point[100];

        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(br.readLine());
            int mode = Integer.parseInt(st.nextToken());
            int xOrA = Integer.parseInt(st.nextToken());
            int yOrB = Integer.parseInt(st.nextToken());

            if (mode == 1) {
                intervals[num++] = new Point(xOrA, yOrB);
            }
            else {
                System.out.println(bfs(xOrA-1, yOrB-1) ? "YES" : "NO");
            }
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
    static boolean[] v = new boolean [111];
	static int[] a = new int [111];
    static int[] b = new int [111];

	static int k = 0;
	public static void dfs(int x){
		v[x] = true;
		for(int i = 1; i <= k; i++){
			if(v[i]) continue;
			if((a[x] > a[i] && a[x] < b[i]) || (b[x] > a[i] && b[x] < b[i])) dfs(i);
		}
	}

	public static void main (String[] args) throws java.lang.Exception
	{
		int n,m,x,y;
		Scanner in = new Scanner(System.in);
		n = in.nextInt();
		for(int i=1;i<=n;i++){
			m = in.nextInt();
	        if(m == 1){
	            k++;
	            a[k] = in.nextInt();
	            b[k] = in.nextInt();
	        }
	        if(m == 2){
	            x = in.nextInt();
	            y = in.nextInt();
				Arrays.fill(v, false);
	            dfs(x);
	            if(v[y]) System.out.println("YES");
	            else System.out.println("NO");
	        }
		}
	}
}


import java.util.*;

/**
 * Problem: Ping-Pong (Easy Version)
 * http://codeforces.com/problemset/problem/320/B
 */
public class W4_320B {
    private static class Interval {
        int low, high;

        Interval(int low, int high) {
            this.low = low;
            this.high = high;
        }

        private boolean canMoveTo(Interval next) {
            return low > next.low && low < next.high ||
                    high > next.low && high < next.high;
        }
    }

    private static boolean hasPath(ArrayList<LinkedList<Integer>> graph, int start, int dest) {
        LinkedList<Integer> toVisit = new LinkedList<>();
        HashSet<Integer> visited = new HashSet<>();
        toVisit.add(start);
        while (!toVisit.isEmpty()) {
            int curNode = toVisit.remove();
            visited.add(curNode);
            for (int node : graph.get(curNode)) {
                if (node == dest) {
                    return true;
                }
                if (!visited.contains(node)) {
                    toVisit.add(node);
                }
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int numQueries = Integer.parseInt(in.nextLine());
        ArrayList<LinkedList<Integer>> graph = new ArrayList<>();
        ArrayList<Interval> intervals = new ArrayList<>();
        for (int q = 0; q < numQueries; q++) {
            int type = in.nextInt();
            if (type == 1) {
                Interval newNode = new Interval(in.nextInt(), in.nextInt());
                int newNodeIndex = intervals.size();
                intervals.add(newNode);
                graph.add(new LinkedList<>());

                for (int i = 0; i < intervals.size(); i++) {
                    if (intervals.get(i).canMoveTo(newNode)) {
                        graph.get(i).add(newNodeIndex);
                    }
                    if (newNode.canMoveTo(intervals.get(i))) {
                        graph.get(newNodeIndex).add(i);
                    }
                }
            } else {
                if (hasPath(graph, in.nextInt() - 1, in.nextInt() - 1)) {
                    System.out.println("YES");
                } else {
                    System.out.println("NO");
                }
            }
        }
    }
}


import java.util.*;
public class B {

	public static class Interval {
		int start;
		int end;
		public Interval(int start, int end){
			this.start = start;
			this.end = end;
		}
	}
	public static Interval[] inter;
	public static boolean[] answer;
	public static int n;

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		n = 0;
		int num = sc.nextInt();
		answer = new boolean[num+1];
	    inter = new Interval[num+1];

		for(int i = 1; i<= num; i++){
			for(int j = 1; j<= num; j++){
				answer[j] = false;
			}
			int mycase = sc.nextInt(); // 1
			if(mycase == 1) {
				n++;
				inter[n] = new Interval(sc.nextInt(), sc.nextInt());
			} else {
				int source = sc.nextInt();
				int target = sc.nextInt();
				dfs(source);
				if(answer[target]) {
					System.out.println("YES");
				} else {
					System.out.println("NO");
				}
			}
		}
	}

	public static void dfs(int k){
		answer[k] = true;
		for(int i = 1;i <= n; i++){
			if(inter[k].start > inter[i].start && inter[k].start < inter[i].end && !answer[i]){
				dfs(i);
			} else if(inter[k].end > inter[i].start && inter[k].end < inter[i].end && !answer[i]){
				dfs(i);
			}
		}
	}
}


import java.util.*;
public class B {

	public static class Interval {
		int start;
		int end;
		public Interval(int start, int end){
			this.start = start;
			this.end = end;
		}
	}
	public static Interval[] inter;
	public static boolean[] answer;
	public static int n;

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		n = 0;
		int num = sc.nextInt();
		answer = new boolean[num+1];
	    inter = new Interval[num+1];

		for(int i = 1; i<= num; i++){
			for(int j = 1; j<= num; j++){
				answer[j] = false;
			}
			int mycase = sc.nextInt(); // 1
			if(mycase == 1) {
				n++;
				inter[n] = new Interval(sc.nextInt(), sc.nextInt());
			} else {
				int source = sc.nextInt();
				int target = sc.nextInt();
				dfs(source);
				if(answer[target]) {
					System.out.println("YES");
				} else {
					System.out.println("NO");
				}
			}
		}
	}

	public static void dfs(int k){
		answer[k] = true;
		for(int i = 2;i <= n; i++){
			if(inter[k].start > inter[i].start && inter[k].start < inter[i].end && !answer[i]){
				dfs(i);
			} else if(inter[k].end > inter[i].start && inter[k].end < inter[i].end && !answer[i]){
				dfs(i);
			}
		}
	}
}


import java.io.*;
import java.util.*;

public class MyClass {
    public static class Node {
        int id;
        List<Node> neighbors;
        int start;
        int end;
        boolean visited = false;

        public Node(int s, int e, int id) {
            this.id = id;
            this.neighbors = new ArrayList<>();
            this.start = s;
            this.end = e;
            this.visited = false;
        }
    }
    public static void addEdges(List<Node> graph) {
        Node base = graph.get(graph.size() - 1);
        for(int i = 0; i < graph.size() - 1; i++) {
            Node cur = graph.get(i);
            if((cur.start < base.start  && base.start < cur.end) || (cur.start < base.end  && base.end < cur.end)) {
                base.neighbors.add(cur);
            }
            if((base.start < cur.start && cur.start < base.end) || (base.start < cur.end && cur.end < base.end)) {
                cur.neighbors.add(base);
            }
        }
    }

    public static void print(List<Node> graph) {
        for(int i = 0; i < graph.size(); i++) {
            System.out.print(i + ": ");
            for(Node n : graph.get(i).neighbors) {
                System.out.print(n.id + ", ");
            }
            System.out.println();
        }
    }

    public static boolean bfs(List<Node> graph, int start, int end) {
        Queue<Node> q = new LinkedList<Node>();
        q.add(graph.get(start));
        while(!q.isEmpty()) {
            Node curr = q.poll();
            if(curr.id == (end)) {
                for(Node n: graph) {
                    n.visited = false;
                }
                return true;
            }
            if(!curr.visited) {
                curr.visited = true;
                for(Node n : curr.neighbors) {
                    if(!n.visited)
                        q.add(n);
                }
            }
        }

        for(Node n: graph) {
            n.visited = false;
        }
        return false;
    }

    public static void main(String args[]) {
      final Scanner s = new Scanner(System.in);
      final int num = s.nextInt();
      final List<Node> graph = new ArrayList<>();
      for(int i = 0; i < num; i++) {
          //add node
          if(s.nextInt() == 1) {
              graph.add(new Node(s.nextInt(), s.nextInt(), graph.size()));
              addEdges(graph);
          } else { //answer question
              //bfs
              //print(graph);
              if(bfs(graph, s.nextInt() - 1, s.nextInt() - 1)) {
                  System.out.println("YES");
              } else {
                  System.out.println("NO");
              }
          }
      }
    }
}


import java.io.*;
import java.util.*;

public class MyClass {
    public static class Node {
        int id;
        List<Node> neighbors;
        int start;
        int end;
        boolean visited = false;

        public Node(int s, int e, int id) {
            this.id = id;
            this.neighbors = new ArrayList<>();
            this.start = s;
            this.end = e;
            this.visited = false;
        }
    }
    public static void addEdges(List<Node> graph) {
        Node base = graph.get(graph.size() - 1);
        for(int i = 0; i < graph.size() - 1; i++) {
            Node cur = graph.get(i);
            if((cur.start < base.start  && base.start < cur.end) || (cur.start < base.end  && base.end < cur.end)) {
                base.neighbors.add(cur);
            }
            if((base.start < cur.start && cur.start < base.end) || (base.start < cur.end && cur.end < base.end)) {
                cur.neighbors.add(base);
            }
        }
    }

    public static void print(List<Node> graph) {
        for(int i = 0; i < graph.size(); i++) {
            System.out.print(i + ": ");
            for(Node n : graph.get(i).neighbors) {
                System.out.print(n.id + ", ");
            }
            System.out.println();
        }
    }

    public static boolean bfs(List<Node> graph, int start, int end) {
        Queue<Node> q = new LinkedList<Node>();
        q.add(graph.get(start));
        while(!q.isEmpty()) {
            Node curr = q.poll();
            if(curr.id == (end)) {
                return true;
            }
            if(!curr.visited) {
                curr.visited = true;
                for(Node n : curr.neighbors) {
                    if(!n.visited)
                        q.add(n);
                }
            }
        }

        for(Node n: graph) {
            n.visited = false;
        }
        return false;
    }

    public static void main(String args[]) {
      final Scanner s = new Scanner(System.in);
      final int num = s.nextInt();
      final List<Node> graph = new ArrayList<>();
      for(int i = 0; i < num; i++) {
          //add node
          if(s.nextInt() == 1) {
              graph.add(new Node(s.nextInt(), s.nextInt(), graph.size()));
              addEdges(graph);
          } else { //answer question
              //bfs
              if(bfs(graph, s.nextInt() - 1, s.nextInt() - 1)) {
                  System.out.println("YES");
              } else {
                  System.out.println("NO");
              }
          }
      }
    }
}


import java.util.*;

public class Hello_world {
    ArrayList<pair> all_pairs=new ArrayList<>();
    public void dfs(pair root){
        root.is_visited=true;
        for(pair n : root.a){
            if(!n.is_visited)
                dfs(n);
        }
    }

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        Hello_world obj=new Hello_world();
        while(n-->0){
            int q=sc.nextInt();
            int x=sc.nextInt();
            int y=sc.nextInt();
            if(q==1) {
                pair np=new pair(x, y);
                obj.all_pairs.add(np);
                for(pair p : obj.all_pairs){
                    p.add_path(np);
                    }
                for(pair p : obj.all_pairs){
                    np.add_path(p);
                }

                }
            else{
                pair root=obj.all_pairs.get(x-1);
                pair dest=obj.all_pairs.get(y-1);
                obj.dfs(root);
                if(dest.is_visited)
                    System.out.println("YES");
                else
                    System.out.println("NO");

                for(pair p : obj.all_pairs)
                    p.is_visited=false;

            }
            }
        }
    }

class pair{
    int x,y;
    ArrayList<pair> a=new ArrayList<>() ;
    boolean is_visited=false;

    public pair(int x , int y){
        this.x=x;
        this.y=y;
    }

    public void add_path(pair p){
        int _a=x;
        int b=y;

        int c=p.x;
        int d=p.y;
        if(c<_a && _a<d || c<b && b<d)
            a.add(p);
    }

}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class template {
  static class InputReader {
    private final BufferedReader br;
    private StringTokenizer st;

    InputReader(final InputStream in) {
      br = new BufferedReader(new InputStreamReader(in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (final IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      final String res = null;
      while (res == null || res.isEmpty()) {
        try {
          return br.readLine();
        } catch (final IOException e) {
          e.printStackTrace();
        }
      }
      return res;
    }
  }

  public static void main(final String[] args) {
    final var reader = new InputReader(System.in);
    final var writer = new PrintWriter(System.out);
    solve(reader, writer);
    writer.close();
  }

  static void solve(InputReader in, PrintWriter out) {
    int n = in.nextInt();
    var adj = new ArrayList<ArrayList<Integer>>();
    var intervals = new ArrayList<Interval>();
    while (n-- > 0) {
      int x = in.nextInt(), y = in.nextInt(), z = in.nextInt();
      if (x == 1) {
        intervals.add(new Interval(y, z));
        adj.add(new ArrayList<Integer>());
        for (int i = 0; i < adj.size() - 1; ++i) {
          var interval = intervals.get(i);
          if ((interval.l < y && interval.r > y) || (interval.l < z && interval.r > z)) {
            adj.get(adj.size() - 1).add(i);
          }
          if ((y < interval.l && z > interval.l) || (y < interval.r && z > interval.r)) {
            adj.get(i).add(adj.size() - 1);
          }
        }
      } else {
        boolean[] vis = new boolean[adj.size()];
        out.println(dfs(adj, vis, z - 1, y - 1) ? "YES" : "NO");
      }
    }
  }

  static boolean dfs(ArrayList<ArrayList<Integer>> adj, boolean[] vis, int target, int u) {
    if (u == target) {
      return true;
    }
    vis[u] = true;
    for (int v : adj.get(u)) {
      if (!vis[v] && dfs(adj, vis, target, v)) {
        return true;
      }
    }
    return false;
  }
}

class Interval {
  int l, r;

  Interval(int l, int r) {
    this.l = l;
    this.r = r;
  }
}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class template {
  static class InputReader {
    private final BufferedReader br;
    private StringTokenizer st;

    InputReader(final InputStream in) {
      br = new BufferedReader(new InputStreamReader(in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (final IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      final String res = null;
      while (res == null || res.isEmpty()) {
        try {
          return br.readLine();
        } catch (final IOException e) {
          e.printStackTrace();
        }
      }
      return res;
    }
  }

  public static void main(final String[] args) {
    final var reader = new InputReader(System.in);
    final var writer = new PrintWriter(System.out);
    solve(reader, writer);
    writer.close();
  }

  static void solve(InputReader in, PrintWriter out) {
    int n = in.nextInt();
    var adj = new ArrayList<ArrayList<Integer>>();
    var intervals = new ArrayList<Interval>();
    while (n-- > 0) {
      int x = in.nextInt(), y = in.nextInt(), z = in.nextInt();
      if (x == 1) {
        intervals.add(new Interval(y, z));
        adj.add(new ArrayList<Integer>());
        for (int i = 0; i < adj.size() - 1; ++i) {
          if ((intervals.get(i).l < y && intervals.get(i).r > y)
              || (intervals.get(i).l < z && intervals.get(i).r > z)) {
            adj.get(i).add(adj.size() - 1);
            adj.get(adj.size() - 1).add(i);
          }
        }
      } else {
        boolean[] vis = new boolean[adj.size()];
        out.println(dfs(adj, vis, y - 1, z - 1) ? "YES" : "NO");
      }
    }
  }

  static boolean dfs(ArrayList<ArrayList<Integer>> adj, boolean[] vis, int target, int u) {
    if (u == target) {
      return true;
    }
    vis[u] = true;
    for (int v : adj.get(u)) {
      if (!vis[v] && dfs(adj, vis, target, v)) {
        return true;
      }
    }
    return false;
  }
}

class Interval {
  int l, r;

  Interval(int l, int r) {
    this.l = l;
    this.r = r;
  }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Queue;
import java.util.LinkedList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        PingPong solver = new PingPong();
        solver.solve(1, in, out);
        out.close();
    }

    static class PingPong {
        private boolean visited[] = new boolean[101];
        private Pair arr[];
        private int n = 0;
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int q = in.nextInt();
            arr = new Pair[q + 1];
            for (int i = 1; i <= q; i++) {
                int type = in.nextInt();
                if (type == 1) {
                    n++;
                    arr[n] = new Pair(in.nextInt(), in.nextInt());
                }
                if (type == 2) {
                    int x = in.nextInt();
                    int y = in.nextInt();
                    visited = new boolean[101];
                    bfs(x);
                    if (!visited[y]) {
                        out.println("NO");
                    } else {
                        out.println("YES");
                    }
                }
            }
        }

        private void bfs(int x) {
            Queue<Pair> queue = new LinkedList<>();
            queue.add(arr[x]);
            visited[x] = true;
            while (!queue.isEmpty()) {
                Pair curr = queue.poll();
                for (int i = 1; i <= n; i++) {
                    if (!visited[i]) {
                        if ((arr[i].x < curr.y && curr.y < arr[i].y) || (arr[i].x < curr.x && curr.x < arr[i].y)) {
                            queue.add(arr[i]);
                            visited[i] = true;
                        }
                    }
                }
            }

        }

        class Pair {
            int x;
            int y;

            public Pair(int x, int y) {
                this.x = x;
                this.y = y;
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

public class PingPong {
	private static class Node {
		int start;
		int end;
		boolean visited;
		List<Edge> neighbors;

		public Node(int start, int end) {
			this.start = start;
			this.end = end;
			this.visited = false;
			this.neighbors = new ArrayList<>();
		}
	}

	public static class Edge {
		Node dest;

		public Edge(Node dest) {
			this.dest = dest;
		}
	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int numQueries = sc.nextInt();
		final List<Node> graph = new ArrayList<>();
		for (int i = 0; i < numQueries; i++) {
			int queryType = sc.nextInt();
			int num1 = sc.nextInt();
			int num2 = sc.nextInt();

			if (queryType == 1) {
				Node newNode = new Node(num1, num2);
				for (Node n : graph) {
					if ((n.start < newNode.start && newNode.start < n.end) || (n.start < newNode.end && newNode.end < n.end)) {
						newNode.neighbors.add(new Edge(n));
					}
					if ((newNode.start < n.end && n.end < newNode.end) || (newNode.start < n.start && n.start < newNode.end)) {
						n.neighbors.add(new Edge(newNode));
					}
				}
				graph.add(newNode);
			}
			else if (queryType == 2) {
				Node firstNode = graph.get(num1-1);
				Node secNode = graph.get(num2-1);
				if (findPath(graph, firstNode, secNode)) {
					System.out.println("YES");
				} else {
					System.out.println("NO");
				}
			}
		}
	}

	private static boolean findPath(List<Node> graph, Node startNode, Node seekNode) {
		Queue<Node> q = new LinkedList<>();
		startNode.visited = true;
		q.add(startNode);
		while (!q.isEmpty()) {
			Node currNode = q.remove();
			if (currNode == seekNode) {
				return true;
			}
			for (Edge e : currNode.neighbors) {
				if (!e.dest.visited) {
					e.dest.visited = true;
					q.add(e.dest);
				}
			}
		}
		return false;
	}
}


import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

public class PingPong {
	private static class Node {
		int start;
		int end;
		boolean visited;
		List<Edge> neighbors;

		public Node(int start, int end) {
			this.start = start;
			this.end = end;
			this.visited = false;
			this.neighbors = new ArrayList<>();
		}
	}

	public static class Edge {
		Node dest;

		public Edge(Node dest) {
			this.dest = dest;
		}
	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int numQueries = sc.nextInt();
		final List<Node> graph = new ArrayList<>();
		for (int i = 0; i < numQueries; i++) {
			int queryType = sc.nextInt();
			int num1 = sc.nextInt();
			int num2 = sc.nextInt();

			if (queryType == 1) {
				Node newNode = new Node(num1, num2);
				for (Node n : graph) {
					if ((n.start < newNode.start && newNode.start < n.end) || (n.start < newNode.end && newNode.end < n.end)) {
						newNode.neighbors.add(new Edge(n));
					}
					if ((newNode.start < n.end && n.end < newNode.end) || (newNode.start < n.start && n.start < newNode.end)) {
						n.neighbors.add(new Edge(newNode));
					}
				}
				graph.add(newNode);
			}
			else if (queryType == 2) {
				Node firstNode = graph.get(num1-1);
				Node secNode = graph.get(num2-1);
				if (findPath(graph, firstNode, secNode)) {
					System.out.println("YES");
				} else {
					System.out.println("NO");
				}

				//clear out visited vertices
				for (int j = 0; j < graph.size(); j++) {
					graph.get(j).visited = false;
				}
			}
		}
	}

	private static boolean findPath(List<Node> graph, Node startNode, Node seekNode) {
		Queue<Node> q = new LinkedList<>();
		startNode.visited = true;
		q.add(startNode);
		while (!q.isEmpty()) {
			Node currNode = q.remove();
			if (currNode == seekNode) {
				return true;
			}
			for (Edge e : currNode.neighbors) {
				if (!e.dest.visited) {
					e.dest.visited = true;
					q.add(e.dest);
				}
			}
		}
		return false;
	}
}


import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

public class Codeforces320B {
	 public static class Pair {
		private int a;
		private int b;
        public Pair(int a, int b) {
        	this.a = a;
        	this.b = b;
        }
    }

    public static void main(String[] args) throws IOException {
    	ArrayList<Pair> intervals = new ArrayList<>();
    	ArrayList<Integer> reach = new ArrayList<>();
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	for(int i = 0; i < n; i ++) {
    		int queryType = sc.nextInt();
    		if(queryType == 1) {
    			reach.add(0);
    			int a = sc.nextInt();
    			int b = sc.nextInt();
    			intervals.add(new Pair(a, b));
    		} else {
    			dfs(sc.nextInt() - 1, intervals, reach);
    			String output = reach.get(sc.nextInt() - 1) == 1 ? "YES" : "NO";
    			for(int j = 0; j < reach.size(); j++){
    				reach.set(j, 0);
    			}
    			System.out.println(output);
    		}
    	}
    }

    private static void dfs(int index, ArrayList<Pair> intervals, ArrayList<Integer> reach) {
    	reach.set(index, 1);
    	for(int i = 0; i < intervals.size(); i++) {
    		if(reach.get(i) == 0){
    			Pair thisInterval = intervals.get(index);
    			Pair otherInterval = intervals.get(i);
    			boolean condition1 = (thisInterval.a > otherInterval.a) && (otherInterval.b > thisInterval.a);
    			boolean condition2 = (thisInterval.b > otherInterval.a) && (otherInterval.b > thisInterval.b);
    			if(condition1 || condition2) {
    				dfs(i, intervals, reach);
    			}
    		}
    	}
    }
}


import java.util.*;

public class PingPong {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        List<Interval> l = new ArrayList<>();
        boolean[] reachable;
        for (int i = 0; i < N; i++) {
             int type = sc.nextInt();
             if (type == 1) {
                 // add a new interval to the end of the list of intervals
                 l.add(new Interval(sc.nextInt(), sc.nextInt()));
             } else {
                 reachable = new boolean[l.size()];
                 int start = sc.nextInt() - 1;
                 int end = sc.nextInt() - 1;
                 bfs(l, reachable, start, end);
                 //relax(l, reachable, start, end);
                 if (reachable[end]) {
                     System.out.println("YES");
                 } else {
                     System.out.println("NO");
                 }
             }
        }
    }

    private static void bfs(List<Interval> l, boolean[] reachable, int start, int end) {
        Queue<QueueObj> q = new LinkedList<>();
        reachable[start] = true;
        q.add(new QueueObj(l.get(start), start));
        while (!q.isEmpty()) {
            QueueObj curObj = q.remove();
            reachable[curObj.pos] = true;
            curObj.i.visited = true;

            for (int i = 0; i < l.size(); i++) {
                Interval iInterval = l.get(i);
                // if the x and y of the  i interval are between the x and y of the j interval,  set it to reachable
                if ((curObj.i.x < iInterval.x && iInterval.x < curObj.i.y) ||
                        (curObj.i.x < iInterval.y && iInterval.y < curObj.i.y)) {
                    reachable[i] = true;
                    if (i == end) {
                        return;
                    }
                    if (!iInterval.visited) {
                        q.add(new QueueObj(l.get(i), i));
                    }
                }
            }
        }
    }

    private static class QueueObj {
        Interval i;
        int pos;

        public QueueObj(Interval i, int pos) {
            this.i = i;
            this.pos = pos;
        }
    }

    public static class Interval {
        int x, y;
        boolean visited;
        public Interval(int a, int b) {
            x = a;
            y = b;
        }
    }
}


import java.util.*;

public class PingPong {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        List<Interval> l = new ArrayList<>();
        boolean[] reachable;
        for (int i = 0; i < N; i++) {
             int type = sc.nextInt();
             if (type == 1) {
                 // add a new interval to the end of the list of intervals
                 l.add(new Interval(sc.nextInt(), sc.nextInt()));
             } else {
                 reachable = new boolean[l.size()];
                 int start = sc.nextInt() - 1;
                 int end = sc.nextInt() - 1;
                 bfs(l, reachable, start, end);
                 //relax(l, reachable, start, end);
                 if (reachable[end]) {
                     System.out.println("YES");
                 } else {
                     System.out.println("NO");
                 }
                 resetAll(l);
             }
        }
    }

    private static void resetAll(List<Interval> l) {
        for (Interval i : l) {
            i.visited = false;
        }
    }

    private static void bfs(List<Interval> l, boolean[] reachable, int start, int end) {
        Queue<QueueObj> q = new LinkedList<>();
        reachable[start] = true;
        l.get(start).visited = true;
        q.add(new QueueObj(l.get(start), start));
        while (!q.isEmpty()) {
            QueueObj curObj = q.remove();

            for (int i = 0; i < l.size(); i++) {
                Interval iInterval = l.get(i);
                // if the x and y of the  i interval are between the x and y of the j interval,  set it to reachable
                if ((curObj.i.x < iInterval.x && iInterval.x < curObj.i.y) ||
                        (curObj.i.x < iInterval.y && iInterval.y < curObj.i.y)) {
                    if (!iInterval.visited) {
                        q.add(new QueueObj(l.get(i), i));
                        reachable[i] = true;
                        l.get(i).visited = true;
                        if (i == end) {
                            return;
                        }
                    }
                }
            }
        }
    }

    private static class QueueObj {
        Interval i;
        int pos;

        public QueueObj(Interval i, int pos) {
            this.i = i;
            this.pos = pos;
        }
    }

    public static class Interval {
        int x, y;
        boolean visited;
        public Interval(int a, int b) {
            x = a;
            y = b;
        }
    }
}


import java.util.*;

public class PingPong {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        List<Interval> l = new ArrayList<>();
        boolean[] reachable;
        for (int i = 0; i < N; i++) {
             int type = sc.nextInt();
             if (type == 1) {
                 // add a new interval to the end of the list of intervals
                 l.add(new Interval(sc.nextInt(), sc.nextInt()));
             } else {
                 reachable = new boolean[l.size()];
                 int start = sc.nextInt() - 1;
                 int end = sc.nextInt() - 1;
                 bfs(l, reachable, start, end);
                 //relax(l, reachable, start, end);
                 if (reachable[end]) {
                     System.out.println("YES");
                 } else {
                     System.out.println("NO");
                 }
             }
        }
    }

    private static void bfs(List<Interval> l, boolean[] reachable, int start, int end) {
        Queue<QueueObj> q = new LinkedList<>();
        reachable[start] = true;
        l.get(start).visited = true;
        q.add(new QueueObj(l.get(start), start));
        while (!q.isEmpty()) {
            QueueObj curObj = q.remove();

            for (int i = 0; i < l.size(); i++) {
                Interval iInterval = l.get(i);
                // if the x and y of the  i interval are between the x and y of the j interval,  set it to reachable
                if ((curObj.i.x < iInterval.x && iInterval.x < curObj.i.y) ||
                        (curObj.i.x < iInterval.y && iInterval.y < curObj.i.y)) {
                    if (!iInterval.visited) {
                        q.add(new QueueObj(l.get(i), i));
                        reachable[i] = true;
                        l.get(i).visited = true;
                        if (i == end) {
                            return;
                        }
                    }
                }
            }
        }
    }

    private static class QueueObj {
        Interval i;
        int pos;

        public QueueObj(Interval i, int pos) {
            this.i = i;
            this.pos = pos;
        }
    }

    public static class Interval {
        int x, y;
        boolean visited;
        public Interval(int a, int b) {
            x = a;
            y = b;
        }
    }
}


import java.util.*;

public class PingPong {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        List<Interval> l = new ArrayList<>();
        boolean[] reachable;
        for (int i = 0; i < N; i++) {
             int type = sc.nextInt();
             if (type == 1) {
                 // add a new interval to the end of the list of intervals
                 l.add(new Interval(sc.nextInt(), sc.nextInt()));
             } else {
                 reachable = new boolean[l.size()];
                 int start = sc.nextInt() - 1;
                 int end = sc.nextInt() - 1;
                 bfs(l, reachable, start, end);
                 //relax(l, reachable, start, end);
                 if (reachable[end]) {
                     System.out.println("YES");
                 } else {
                     System.out.println("NO");
                 }
             }
        }
    }

    private static void bfs(List<Interval> l, boolean[] reachable, int start, int end) {
        Queue<QueueObj> q = new LinkedList<>();
        reachable[start] = true;
        q.add(new QueueObj(l.get(start), start));
        while (!q.isEmpty()) {
            QueueObj curObj = q.remove();
            reachable[curObj.pos] = true;

            for (int i = 0; i < l.size(); i++) {
                Interval iInterval = l.get(i);
                // if the x and y of the  i interval are between the x and y of the j interval,  set it to reachable
                if ((curObj.i.x < iInterval.x && iInterval.x < curObj.i.y) ||
                        (curObj.i.x < iInterval.y && iInterval.y < curObj.i.y)) {
                    reachable[i] = true;
                    if (i == end) {
                        return;
                    }
                    q.add(new QueueObj(l.get(i), i));
                }
            }
        }
    }

    private static class QueueObj {
        Interval i;
        int pos;

        public QueueObj(Interval i, int pos) {
            this.i = i;
            this.pos = pos;
        }
    }

    public static class Interval {
        int x, y;
        public Interval(int a, int b) {
            x = a;
            y = b;
        }
    }
}


import java.util.*;

public class PingPong {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        List<Interval> l = new ArrayList<>();
        boolean[] reachable;
        for (int i = 0; i < N; i++) {
             int type = sc.nextInt();
             if (type == 1) {
                 // add a new interval to the end of the list of intervals
                 l.add(new Interval(sc.nextInt(), sc.nextInt()));
             } else {
                 int start = sc.nextInt() - 1;
                 int end = sc.nextInt() - 1;
                 bfs(l, start, end);
                 //relax(l, reachable, start, end);
                 if (l.get(end).visited) {
                     System.out.println("YES");
                 } else {
                     System.out.println("NO");
                 }
             }
        }
    }

    private static void resetAll(List<Interval> l) {
        for (Interval i : l) {
            i.visited = false;
        }
    }

    private static void bfs(List<Interval> l, int start, int end) {
        resetAll(l);
        Queue<QueueObj> q = new LinkedList<>();
        q.add(new QueueObj(l.get(start), start));
        // l.get(start).visited = true;

        while (!q.isEmpty()) {
            QueueObj currentObj = q.remove();
            if (currentObj.pos == end) {
                currentObj.i.visited = true;
                return;
            }
            if (currentObj.i.visited ){
                continue;
            }
            currentObj.i.visited = true;
            for (int i = 0; i < l.size(); i++) {
                // if it's able to reach the interval, add it to the queue.
                Interval iInterval = l.get(i);
                if (canReach(currentObj.i, iInterval)) {
                    q.add(new QueueObj(iInterval, i));
                }
            }
        }
    }

    private static boolean canReach(Interval current, Interval next) {
        return (next.x < current.x && current.x < next.y) || (next.x < current.y && current.y < next.y);
    }

//    private static void bfs(List<Interval> l, boolean[] reachable, int start, int end) {
//        Queue<QueueObj> q = new LinkedList<>();
//        reachable[start] = true;
//        l.get(start).visited = true;
//        q.add(new QueueObj(l.get(start), start));
//        while (!q.isEmpty()) {
//            QueueObj curObj = q.remove();
//
//            for (int i = 0; i < l.size(); i++) {
//                Interval iInterval = l.get(i);
//                // if the x and y of the  i interval are between the x and y of the j interval,  set it to reachable
//                if ((curObj.i.x < iInterval.x && iInterval.x < curObj.i.y) ||
//                        (curObj.i.x < iInterval.y && iInterval.y < curObj.i.y)) {
//                    if (!iInterval.visited) {
//                        q.add(new QueueObj(l.get(i), i));
//                        reachable[i] = true;
//                        l.get(i).visited = true;
//                        if (i == end) {
//                            return;
//                        }
//                    }
//                }
//            }
//        }
//    }

    private static class QueueObj {
        Interval i;
        int pos;

        public QueueObj(Interval i, int pos) {
            this.i = i;
            this.pos = pos;
        }
    }

    public static class Interval {
        int x, y;
        boolean visited;
        public Interval(int a, int b) {
            x = a;
            y = b;
        }
    }
}


import java.util.*;

public class PingPong {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        List<Interval> l = new ArrayList<>();
        boolean[] reachable;
        for (int i = 0; i < N; i++) {
             int type = sc.nextInt();
             if (type == 1) {
                 // add a new interval to the end of the list of intervals
                 l.add(new Interval(sc.nextInt(), sc.nextInt()));
             } else {
                 reachable = new boolean[l.size()];
                 int start = sc.nextInt() - 1;
                 int end = sc.nextInt() - 1;
                 bfs(l, reachable, start, end);
                 //relax(l, reachable, start, end);
                 if (reachable[end]) {
                     System.out.println("YES");
                 } else {
                     System.out.println("NO");
                 }
             }
        }
    }

    private static void bfs(List<Interval> l, boolean[] reachable, int start, int end) {
        Queue<QueueObj> q = new LinkedList<>();
        reachable[start] = true;
        q.add(new QueueObj(l.get(start), start));
        while (!q.isEmpty()) {
            QueueObj curObj = q.remove();

            for (int i = 0; i < l.size(); i++) {
                Interval iInterval = l.get(i);
                // if the x and y of the  i interval are between the x and y of the j interval,  set it to reachable
                if ((curObj.i.x < iInterval.x && iInterval.x < curObj.i.y) ||
                        (curObj.i.x < iInterval.y && iInterval.y < curObj.i.y)) {
                    if (!iInterval.visited) {
                        q.add(new QueueObj(l.get(i), i));
                        reachable[i] = true;
                        if (i == end) {
                            return;
                        }
                    }
                }
            }
        }
    }

    private static class QueueObj {
        Interval i;
        int pos;

        public QueueObj(Interval i, int pos) {
            this.i = i;
            this.pos = pos;
        }
    }

    public static class Interval {
        int x, y;
        boolean visited;
        public Interval(int a, int b) {
            x = a;
            y = b;
        }
    }
}


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class PingPong {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        List<Interval> l = new ArrayList<>();
        boolean[] reachable;
        for (int i = 0; i < N; i++) {
             int type = sc.nextInt();
             if (type == 1) {
                 // add a new interval to the end of the list of intervals
                 l.add(new Interval(sc.nextInt(), sc.nextInt()));
             } else {
                 reachable = new boolean[l.size()];
                 int start = sc.nextInt() - 1;
                 int end = sc.nextInt() - 1;
                 relax(l, reachable, start, end);
                 if (reachable[end]) {
                     System.out.println("YES");
                 } else {
                     System.out.println("NO");
                 }
             }
        }
    }

    private static void relax(List<Interval> l, boolean[] reachable, int start, int end) {
        reachable[start] = true;
        for (int i = start; i < l.size(); i++) {
            for (int j = 0; j < l.size(); j++) {
                if (i != j) {
                    // if it is not reachable, do nothing
                    if (reachable[i]) {
                        Interval iInterval = l.get(i);
                        Interval jInterval = l.get(j);
                        // if the x and y of the  i interval are between the x and y of the j interval,  set it to reachable
                        if ((jInterval.x < iInterval.x && iInterval.x < jInterval.y) ||
                                (jInterval.x < iInterval.y && iInterval.y < jInterval.y)) {
                            reachable[j] = true;
                        }
                    }

                }
            }
        }
        for (int i = 0; i < start; i++) {
            for (int j  = 0; j < l.size(); j++) {
                if (i != j) {
                    // if it is not reachable, do nothing
                    if (reachable[i]) {
                        Interval iInterval = l.get(i);
                        Interval jInterval = l.get(j);
                        // if the x and y of the  i interval are between the x and y of the j interval,  set it to reachable
                        if ((jInterval.x < iInterval.x && iInterval.x < jInterval.y) ||
                                (jInterval.x < iInterval.y && iInterval.y < jInterval.y)) {
                            reachable[j] = true;
                        }
                    }

                }
            }
        }
    }

    public static class Interval {
        int x, y;
        public Interval(int a, int b) {
            x = a;
            y = b;
        }
    }
}


import java.io.*;
import java.util.ArrayList;

public class competetive  {
     static class pair{
         long f;
         long s;
         int ind;
         pair(long a, long b, int c){
             this.f=a;
             this.s=b;
             this.ind=c;
         }
         long getF(){
             return f;
         }
         long getS(){
             return s;
         }
         int getInd(){
             return ind;
         }
     }
     static ArrayList<ArrayList<Integer>>l=new ArrayList<>();
     static boolean[]vis=new boolean[100001];
     static int[]dis=new int[100001];
     static int[]fdis=new int[100001];
     static int ans=0;
     static void dfs(int node){
         vis[node]=true;
         for(int child:l.get(node)){
             if(!vis[child]){
                 dfs(child);
             }
         }
     }
     static boolean dfs(int a, int b){
         vis[a]=true;
         if(a==b)return true;
         for(int ch:l.get(a)){
             if(!vis[ch]){
                 return dfs(ch,b);
             }
         }
         return false;
     }
     public static void main(String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        ArrayList<pair>p=new ArrayList<>();
        int n=Integer.parseInt(br.readLine());
        int t=1;
         for(int i=0;i<=n;i++){
             l.add(i,new ArrayList<>());
             vis[i]=false;
         }
        for(int i=0;i<n;i++){
            String line=br.readLine();
            String []s=line.trim().split(" ");
            long a=Long.parseLong(s[1]);
            long b=Long.parseLong(s[2]);
            int c=Integer.parseInt(s[0]);

            int mx[][]=new int [1000][1000];
            if(c==1){
                p.add(new pair(a,b,t));
                t++;
                for(int j=0;j<p.size();j++){
                    for(int k=j+1;k<p.size();k++){
                        long l1=p.get(j).getF();
                        long r1=p.get(j).getS();
                        long l2=p.get(k).getF();
                        long r2=p.get(k).getS();
                        if(((l2<l1&&r2>l1)||(l2<r1&&l2>l1))&&mx[j+1][k+1]==0){
                            l.get(j+1).add(k+1);
                            l.get(k+1).add(j+1);
                            mx[j+1][k+1]=1;
                            mx[k+1][j+1]=1;
                        }
                    }
                }
            }else{
                if(dfs((int)a,(int) b)){
                    out.write("YES");
                    out.newLine();
                }else{
                    out.write("NO");
                    out.newLine();
                }
                for(int v=0;v<=n;v++){
                    vis[v]=false;
                }
            }
        }
        out.flush();
    }
}


import java.io.*;
import java.util.ArrayList;

public class competetive  {
     static class pair{
         long f;
         long s;
         int ind;
         pair(long a, long b, int c){
             this.f=a;
             this.s=b;
             this.ind=c;
         }
         long getF(){
             return f;
         }
         long getS(){
             return s;
         }
         int getInd(){
             return ind;
         }
     }
     static ArrayList<ArrayList<Integer>>l=new ArrayList<>();
     static boolean[]vis=new boolean[100001];
     static int[]dis=new int[100001];
     static int[]fdis=new int[100001];
     static int ans=0;
     static void dfs(int node){
         vis[node]=true;
         for(int child:l.get(node)){
             if(!vis[child]){
                 dfs(child);
             }
         }
     }
     static boolean isOverlap(long a, long b, long c, long d){
         if((c<a&&a<d) || (c<b&&b<d)){
             return true;
         }
         return false;
     }
     static boolean dfs(int a, int b){
         vis[a]=true;
         if(a==b)return true;
         for(int ch:l.get(a)){
             if(!vis[ch]){
                 return dfs(ch,b);
             }
         }
         return false;
     }
     public static void main(String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        ArrayList<pair>p=new ArrayList<>();
        int n=Integer.parseInt(br.readLine());
        int t=1;
         for(int i=0;i<=n;i++){
             l.add(i,new ArrayList<>());
             vis[i]=false;
         }
        for(int i=0;i<n;i++){
            String line=br.readLine();
            String []s=line.trim().split(" ");
            long a=Long.parseLong(s[1]);
            long b=Long.parseLong(s[2]);
            int c=Integer.parseInt(s[0]);

            int mx[][]=new int [1000][1000];
            if(c==1){
                p.add(new pair(a,b,t));
                t++;
                for(int j=0;j<p.size();j++){
                    for(int k=0;k<p.size();k++){
                        long l1=p.get(j).getF();
                        long r1=p.get(j).getS();
                        long l2=p.get(k).getF();
                        long r2=p.get(k).getS();
                        if(isOverlap(l1,r1,l2,r2) &&mx[j+1][k+1]==0&&j!=k){
                            l.get(j+1).add(k+1);
                            mx[j+1][k+1]=1;
                        }
                    }
                }
            }else{
                if(dfs((int)a,(int) b)){
                    out.write("YES");
                    out.newLine();
                }else{
                    out.write("NO");
                    out.newLine();
                }
                for(int v=0;v<=n;v++){
                    vis[v]=false;
                }
            }
        }
        out.flush();
    }
}


import java.io.*;
import java.util.ArrayList;

public class competetive  {
     static class pair{
         long f;
         long s;
         int ind;
         pair(long a, long b, int c){
             this.f=a;
             this.s=b;
             this.ind=c;
         }
         long getF(){
             return f;
         }
         long getS(){
             return s;
         }
         int getInd(){
             return ind;
         }
     }
     static ArrayList<ArrayList<Integer>>l=new ArrayList<>();
     static boolean[]vis=new boolean[100001];
     static int[]dis=new int[100001];
     static int[]fdis=new int[100001];
     static int ans=0;
     static void dfs(int node){
         vis[node]=true;
         for(int child:l.get(node)){
             if(!vis[child]){
                 dfs(child);
             }
         }
     }
     static boolean isOverlap(long a, long b, long c, long d){
         if((c<a&&a<d) || (c<b&&b<d)){
             return true;
         }
         return false;
     }
     static boolean dfs(int a, int b){
         vis[a]=true;
         if(a==b)return true;
         for(int ch:l.get(a)){
             if(!vis[ch]){
                 return dfs(ch,b);
             }
         }
         return false;
     }
     public static void main(String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        ArrayList<pair>p=new ArrayList<>();
        int n=Integer.parseInt(br.readLine());
        int t=1;
         for(int i=0;i<=n;i++){
             l.add(i,new ArrayList<>());
             vis[i]=false;
         }
        for(int i=0;i<n;i++){
            String line=br.readLine();
            String []s=line.trim().split(" ");
            long a=Long.parseLong(s[1]);
            long b=Long.parseLong(s[2]);
            int c=Integer.parseInt(s[0]);

            int mx[][]=new int [1000][1000];
            if(c==1){
                p.add(new pair(a,b,t));
                t++;
                for(int j=0;j<p.size();j++){
                    for(int k=0;k<p.size();k++){
                        long l1=p.get(j).getF();
                        long r1=p.get(j).getS();
                        long l2=p.get(k).getF();
                        long r2=p.get(k).getS();
                        if(isOverlap(l1,r1,l2,r2) &&mx[j+1][k+1]==0&&j!=k){
                            l.get(j+1).add(k+1);
                            l.get(k+1).add(j+1);
                            mx[j+1][k+1]=1;
                            mx[k+1][j+1]=1;
                        }
                    }
                }
            }else{
                if(dfs((int)a,(int) b)){
                    out.write("YES");
                    out.newLine();
                }else{
                    out.write("NO");
                    out.newLine();
                }
                for(int v=0;v<=n;v++){
                    vis[v]=false;
                }
            }
        }
        out.flush();
    }
}


import java.io.*;
import java.util.ArrayList;

public class competetive  {
     static class pair{
         long f;
         long s;
         int ind;
         pair(long a, long b, int c){
             this.f=a;
             this.s=b;
             this.ind=c;
         }
         long getF(){
             return f;
         }
         long getS(){
             return s;
         }
         int getInd(){
             return ind;
         }
     }
     static ArrayList<ArrayList<Integer>>l=new ArrayList<>();
     static boolean[]vis=new boolean[100001];
     static int[]dis=new int[100001];
     static int[]fdis=new int[100001];
     static int ans=0;
     static boolean flag=false;
     static void dfs(int node, int c){
         vis[node]=true;
         if(node==c){
             flag=true;
         }
         for(int child:l.get(node)){
             if(!vis[child]){
                 dfs(child,c);
             }
         }
     }
     static boolean isOverlap(long a, long b, long c, long d){
         if((c<a&&a<d) || (c<b&&b<d)  ){
             return true;
         }
         return false;
     }

     public static void main(String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        ArrayList<pair>p=new ArrayList<>();
        int n=Integer.parseInt(br.readLine());
        int t=1;
         for(int i=0;i<=n;i++){
             l.add(i,new ArrayList<>());
             vis[i]=false;
         }
        for(int i=0;i<n;i++){
            String line=br.readLine();
            String []s=line.trim().split(" ");
            long a=Long.parseLong(s[1]);
            long b=Long.parseLong(s[2]);
            int c=Integer.parseInt(s[0]);

            int mx[][]=new int [1000][1000];
            if(c==1){
                p.add(new pair(a,b,t));
                t++;
                for(int j=0;j<p.size();j++){
                    for(int k=0;k<p.size();k++){
                        long l1=p.get(j).getF();
                        long r1=p.get(j).getS();
                        long l2=p.get(k).getF();
                        long r2=p.get(k).getS();
                        if(isOverlap(l1,r1,l2,r2) &&mx[j+1][k+1]==0&&j!=k){
                            l.get(j+1).add(k+1);
                            mx[j+1][k+1]=1;
                        }
                    }
                }
            }else{
                flag=false;
                dfs((int)a,(int)b);
                if(!flag)out.write("NO"+'\n');
                else out.write("YES"+'\n');
                for(int v=0;v<=n;v++){
                    vis[v]=false;
                }
            }

        }

        out.flush();
    }
}


import java.io.*;
import java.util.ArrayList;

public class competetive  {
     static class pair{
         long f;
         long s;
         int ind;
         pair(long a, long b, int c){
             this.f=a;
             this.s=b;
             this.ind=c;
         }
         long getF(){
             return f;
         }
         long getS(){
             return s;
         }
         int getInd(){
             return ind;
         }
     }
     static ArrayList<ArrayList<Integer>>l=new ArrayList<>();
     static boolean[]vis=new boolean[100001];
     static int[]dis=new int[100001];
     static int[]fdis=new int[100001];
     static int ans=0;
     static void dfs(int node){
         vis[node]=true;
         for(int child:l.get(node)){
             if(!vis[child]){
                 dfs(child);
             }
         }
     }
     static boolean dfs(int a, int b){
         vis[a]=true;
         if(a==b)return true;
         for(int ch:l.get(a)){
             if(!vis[ch]){
                 return dfs(ch,b);
             }
         }
         return false;
     }
     public static void main(String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        ArrayList<pair>p=new ArrayList<>();
        int n=Integer.parseInt(br.readLine());
        int t=1;
         for(int i=0;i<=n;i++){
             l.add(i,new ArrayList<>());
             vis[i]=false;
         }
        for(int i=0;i<n;i++){
            String line=br.readLine();
            String []s=line.trim().split(" ");
            long a=Long.parseLong(s[1]);
            long b=Long.parseLong(s[2]);
            int c=Integer.parseInt(s[0]);

            int mx[][]=new int [1000][1000];
            if(c==1){
                p.add(new pair(a,b,t));
                t++;
                for(int j=0;j<p.size();j++){
                    for(int k=j+1;k<p.size();k++){
                        long l1=p.get(j).getF();
                        long r1=p.get(j).getS();
                        long l2=p.get(k).getF();
                        long r2=p.get(k).getS();
                        if((l2<l1||l2<r1)&&mx[j+1][k+1]==0){
                            l.get(j+1).add(k+1);
                            l.get(k+1).add(j+1);
                            mx[j+1][k+1]=1;
                            mx[k+1][j+1]=1;
                        }
                    }
                }
            }else{
                if(dfs((int)a,(int) b)){
                    out.write("YES");
                    out.newLine();
                }else{
                    out.write("NO");
                    out.newLine();
                }
                for(int v=0;v<=n;v++){
                    vis[v]=false;
                }
            }
        }
        out.flush();
    }
}


#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define double long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i=a; i<b; ++i)
#define dbg(x) { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const double eps = 0.0000001;
const double PI = acos(-1.0);
const int MOD = 1e9+7;
const int N  = 105;

vector<int> g[N];
pii temp[N];
int vis[N];

bool ck (pii x, pii y) {
    int a = x.fi, b = x.se, c = y.fi, d = y.se;
    if ((c < a && a < d) || (c < b && b < d)) return 1;
    return 0;
}

bool dfs (int a, int b) {
    if (a==b) return 1;
    vis[a] = 1;
    for (auto i: g[a]) {
        if (!vis[i])
            return dfs(i, b);
    }
    return 0;
}

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    IOS;

    int t;
    cin >> t;
    int c = 1;
    for (int i = 1; i <= t; i++) {
        int n, x, y;
        cin >> n >> x >> y;
        if (n==1) {temp[c] = {x,y}; c++;}
        else {
            for (int j = 0; j < N; j++)
            {
                vis[j] = 0;
                g[j].clear();
            }
            for (int j = 1; j <= c; j++) {
                for (int k = 1; k <= c; k++) {
                    if (ck(temp[j],temp[k])) g[j].pb(k);
                }
            }
            if (dfs (x, y)) cout << "YES\n";
            else cout << "NO\n";
        }
    }
    return 0;
}


#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define double long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i=a; i<b; ++i)
#define dbg(x) { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const double eps = 0.0000001;
const double PI = acos(-1.0);
const int MOD = 1e9+7;
const int N  = 105;

vector<int> g[N];
pii temp[N];
int vis[N];

bool ck (pii x, pii y) {
    int a = x.fi, b = x.se, c = y.fi, d = y.se;
    if ((c < a && a < d) || (c < b && b < d)) return 1;
    return 0;
}

int ans;

void dfs (int a, int b) {
    if (a==b) ans = 1;
    vis[a] = 1;
    for (auto i: g[a]) {
        if(!vis[i])
            dfs(i,b);
    }
}

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    IOS;

    int t;
    cin >> t;
    int c = 1;
    for (int i = 1; i <= t; i++) {
        int n, x, y;
        cin >> n >> x >> y;
        if (n==1) {temp[c] = {x,y}; c++;}
        else {
            for (int j = 0; j < N; j++)
            {
                vis[j] = 0;
                g[j].clear();
            }
            for (int j = 1; j <= c; j++) {
                for (int k = 1; k <= c; k++) {
                    if (ck(temp[j],temp[k])) g[j].pb(k);
                }
            }
            dfs(x,y);
            if (ans) cout << "YES\n";
            else cout << "NO\n";
        }
    }
    return 0;
}


#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define double long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i=a; i<b; ++i)
#define dbg(x) { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const double eps = 0.0000001;
const double PI = acos(-1.0);
const int MOD = 1e9+7;
const int N  = 105;

vector<int> g[N];
pii temp[N];
int vis[N];

bool ck (pii x, pii y) {
    int a = x.fi, b = x.se, c = y.fi, d = y.se;
    if ((c < a && a < d) || (c < b && b < d)) return 1;
    return 0;
}

bool dfs (int a, int b) {
    if (a==b) return 1;
    vis[a] = 1;
    for (auto i: g[a]) {
        if (!vis[i])
            return dfs(i, b);
    }
}

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    IOS;

    int t;
    cin >> t;
    int c = 1;
    for (int i = 1; i <= t; i++) {
        int n, x, y;
        cin >> n >> x >> y;
        if (n==1) {temp[c] = {x,y}; c++;}
        else {
            for (int j = 0; j < N; j++)
            {
                vis[j] = 0;
                g[j].clear();
            }
            for (int j = 1; j <= c; j++) {
                for (int k = 1; k <= c; k++) {
                    if (ck(temp[j],temp[k])) g[j].pb(k);
                }
            }
            if (dfs (x, y)) cout << "YES\n";
            else cout << "NO\n";
        }
    }
    return 0;
}