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.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

public class Ping_Pong {

	public static void main(String[] args) {
		// we are really just doing a Breadth first search
		// hard part is figure out if any nodes connects to the other
//	    InputStreamReader isr = new InputStreamReader(System.in);
//		BufferedReader in = new BufferedReader(isr);
		Scanner in = new Scanner(System.in);
		int cases = in.nextInt();
		in.nextLine();
		int totalAdded = 0;
		// the graph will be a list of nodes and their neighbors
		ArrayList<Vertex> graph = new ArrayList<>();
		for(int i=0; i < cases; i++)
		{
			int type = in.nextInt();
			// node insertion
			if(type == 1)
			{
				int a = in.nextInt();
				int b = in.nextInt();
				Vertex temp = new Vertex(a, b, totalAdded+1);
				// now we loop through our vertex list and check if existing 
				// can reach this vertex
				for(int j = 0; j < totalAdded; j++)
				{
					Vertex v = graph.get(j);
					int c = v.interval_start;
					int d = v.interval_end;
					// cam we get to this node from new node?
					if ((c < a && c < d && a < d) || (c < b && c < d && b < d))
						temp.addNeighbor(v.when_added);
					// can we get to new node from this node?
					if ((a < c && c < b && a < b) || (a < d && a < b && d < b))
						v.addNeighbor(totalAdded+1);
				}
				// can now safely insert
				graph.add(temp);
				totalAdded++;
				// System.out.println("Current graphs");
				// System.out.println(graph.toString());
			}
			else
			{
				// note the interval to start and end at
				int start = in.nextInt();
				int end = in.nextInt();
				// gotta reset state
				for(Vertex v : graph)
					v.visited = false;
				if(BFS(graph, start, end))
					System.out.println("YES");
				else
					System.out.println("NO");
			}
			
		}
	}
	
	public static boolean BFS(ArrayList<Vertex> graph, int start, int end)
	{
		LinkedList<Vertex> toVisit = new LinkedList<>();
		// always from index 1 to n
		Vertex begin = graph.get(start-1);
		toVisit.add(begin);
		while (!toVisit.isEmpty()) 
		{
			Vertex cur = toVisit.poll();
			// System.out.println("Current node is " + cur.toString());
			// did we find it?
			if (cur.visited)
				continue;
			else if (cur.when_added == end)
				return true;
			else
			{
				// traverse its neighbors
				cur.visited = true;
				for(int n : cur.neighbors)
				{
					Vertex neighbor = graph.get(n-1);
					// if has not visited neighbor
					if (!neighbor.visited)
						toVisit.add(neighbor);
				}
			}
		}
		return false;
	}
	private static class Vertex implements Comparable<Vertex>
	{
		int when_added;
		int interval_start;
		int interval_end;
		boolean visited;
		ArrayList<Integer> neighbors;
		public Vertex(int a, int b, int when_added)
		{
			this.interval_start = a;
			this.interval_end = b;
			neighbors = new ArrayList<>();
			this.when_added = when_added;
			this.visited = false;
		}
		public void addNeighbor(int when_added)
		{
			neighbors.add(when_added);
		}
		@Override
		public int compareTo(Vertex o) 
		{
			Vertex another = (Vertex) o;
			return this.when_added - another.when_added;
		}
		@Override
		public String toString()
		{
			return String.format("Interval: %d, %d; added: %d; visited %s; neighbors: %s;", 
					interval_start, interval_end, when_added, visited, neighbors.toString());
		}
	}
}
