In this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c < a < d or c < b < d. Also there is a path from interval I1 from our set to interval I2 from our set if there is a sequence of successive moves starting from I1 so that we can reach I2.

Your program should handle the queries of the following two types:

  1. "1 x y" (x < y) — add the new interval (x, y) to the set of intervals. The length of the new interval is guaranteed to be strictly greater than all the previous intervals.
  2. "2 a b" (a ≠ b) — answer the question: is there a path from a-th (one-based) added interval to b-th (one-based) added interval? 



Answer all the queries. Note, that initially you have an empty set of intervals.

Input

The first line of the input contains integer n denoting the number of queries, (1 ≤ n ≤ 100). Each of the following lines contains a query as described above. All numbers in the input are integers and don't exceed 109 by their absolute value.

It's guaranteed that all queries are correct.

Output

For each query of the second type print "YES" or "NO" on a separate line depending on the answer.

Examples

Input

5
1 1 5
1 5 11
2 1 2
1 2 9
2 1 2


Output

NO
YES
import java.io.*;
import java.util.*;

/**
 * Created by madeline on 2/16/17.
 * Solution to http://codeforces.com/problemset/problem/320/B
 * Assignment 4 CS104C
 */
public class CF320B {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int num_queries = sc.nextInt();

        List<int[]> intervals = new ArrayList<>(num_queries);
        List<Node> graph = new ArrayList<>(num_queries);


        int node_num = 1;
        while (num_queries-- > 0) {

            int query_type = sc.nextInt();
            int lower_bound = sc.nextInt();
            int upper_bound = sc.nextInt();

            if (query_type == 1){
                int[] new_interval = new int[2];
                new_interval[0] = lower_bound;
                new_interval[1] = upper_bound;

                Node new_node = new Node(node_num, lower_bound, upper_bound);

                for(int [] interval: intervals){

                    //Edges are directed??? fix this condition
                    if ((interval[0] < new_interval[0]  && new_interval[0] < interval[1]) ||
                            (interval[0] < new_interval[1] && new_interval[1] < interval[1])) {
                        // intervals connect, create edge in graph
                        Node nieghbor = graph.get(intervals.indexOf(interval));
                        new_node.neighbors.add(nieghbor);
                        //nieghbor.neighbors.add(new_node);
                    }
                    if ((new_interval[0] < interval[0]  && interval[0] < new_interval[1]) ||
                            (new_interval[0] < interval[1] && interval[1] < new_interval[1])){
                        // intervals connect, create edge in graph
                        Node nieghbor = graph.get(intervals.indexOf(interval));
                        //new_node.neighbors.add(nieghbor);
                        nieghbor.neighbors.add(new_node);

                    }
                }
                intervals.add(new_interval);
                graph.add(new_node);
                node_num++;
                //print_graph(graph);
            }else if(query_type == 2){
                //int[] start_interval = intervals.get(lower_bound);
                //int [] dest_interval = intervals.get(upper_bound);
                Node start = graph.get(lower_bound-1);
                Node dest = graph.get(upper_bound-1);
                set_visited(graph);
                Boolean result = dfs(start, dest);
                if(result){
                    System.out.println("YES");
                }else{
                    System.out.println("NO");
                }

            }
        }

    }

    public static Boolean dfs(Node start, Node dest){
        Stack<Node> toVisit = new Stack<>();
        toVisit.push(start);
        //System.out.println("starting dfs");

        while(!toVisit.isEmpty()){
            Node cur = toVisit.pop();
            //System.out.printf("poping node %d, visited: %b\n", cur.node_num, cur.visited);

            if (cur.node_num == dest.node_num){
                //System.out.println("ending dfs, found it");
                return true;
            }

            if(!cur.visited){
                //System.out.printf("visiting node %d\n", cur.node_num);
                cur.visited = true;
                for(Node neighbor:cur.neighbors){
                    toVisit.push(neighbor);
                }
            }
        }
        //System.out.println("ending dfs, nothing found");
        return false;
    }

    public  static void print_graph(List<Node> graph){
        System.out.println("**************");
        for(Node c:graph){
            System.out.printf("Node:%d bound: %d-%d Neighbors", c.node_num, c.low, c.high);
            for(Node n:c.neighbors){
                System.out.printf(", %d", n.node_num);
            }
            System.out.println();
        }
        System.out.println("**************");
    }

    public static void set_visited(List<Node> graph){
        for(Node c:graph){
            c.visited = false;
        }
    }
}

class Node {

    int node_num;
    ArrayList<Node> neighbors;
    Boolean visited;
    int low;
    int high;

    Node(int num, int low_bound, int high_bound){
        node_num = num;
        neighbors = new ArrayList<>();
        visited = false;
        low = low_bound;
        high = high_bound;

    }
}
