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.math.BigInteger;
import java.util.*;

public class CF {
    public static void main(String[] args) {

        InputReader inputReader = new InputReader(System.in);
        PrintWriter printWriter = new PrintWriter(System.out, true);

        int n = inputReader.nextInt();
        GraphBFS graph = new GraphBFS(n);
        for (int i = 0; i < n; i++) {
            int command = inputReader.nextInt();
            int a = inputReader.nextInt();
            int b = inputReader.nextInt();
            if (command == 1) {
                graph.addVertex(a, b);
            } else {
                if (graph.pathExists(a, b)) {
                    printWriter.println("YES");
                } else {
                    printWriter.println("NO");
                }
            }
        }

        printWriter.close();
    }

    private static class GraphBFS {
        private static int count;
        private int[][] v;
        private ArrayDeque<Integer>[] adj;
        private boolean[] visited;
        private int[] parent;

        public GraphBFS(int n) {
            v = new int[n][2];
            adj = (ArrayDeque<Integer>[]) new ArrayDeque[n];
            for (int i = 0; i < n; i++) {
                adj[i] = new ArrayDeque<>();
            }
            visited = new boolean[n];
            parent = new int[n];
        }

        public void addVertex(int a, int b) {
            v[count][0] = a - 1;
            v[count][1] = b - 1;

            for (int i = 0; i < count; i++) {
                if ((v[i][0] < v[count][0] && v[count][0] < v[i][1]) ||
                        (v[i][0] < v[count][1] && v[count][1] < v[i][1])) {
                    addEdge(count, i);
                }
                if ((v[count][0] < v[i][0] && v[i][0] < v[count][1]) ||
                        (v[count][0] < v[i][1] && v[i][1] < v[count][1])) {
                    addEdge(i, count);
                }
            }
            count++;
        }

        private void addEdge(int u, int v) {
            adj[u].offer(v);
        }

        private boolean pathExists(int a, int b) {
            a--; b--;
            for (int i = 0; i < count; i++) {
                visited[i] = false;
                parent[i] = Integer.MAX_VALUE;
            }
            visited[a] = true;
            ArrayDeque<Integer> queue = new ArrayDeque<>(count);
            queue.offer(a);
            while (!queue.isEmpty()) {
                int next = queue.poll();
                for (int v : adj[next]) {
                    if (!visited[v]) {
                        if (v == b) {
                            return true;
                        }
                        parent[v] = next;
                        visited[v] = true;
                        queue.offer(v);
                    }
                }
            }
            return false;
        }
    }

    private static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public int[] nextIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; ++i) {
                array[i] = nextInt();
            }
            return array;
        }

        public long[] nextLongArray(int size) {
            long[] array = new long[size];
            for (int i = 0; i < size; ++i) {
                array[i] = nextLong();
            }
            return array;
        }

        public double[] nextDoubleArray(int size) {
            double[] array = new double[size];
            for (int i = 0; i < size; ++i) {
                array[i] = nextDouble();
            }
            return array;
        }

        public String[] nextStringArray(int size) {
            String[] array = new String[size];
            for (int i = 0; i < size; ++i) {
                array[i] = next();
            }
            return array;
        }

        public boolean[][] nextBooleanTable(int rows, int columns, char trueCharacter) {
            boolean[][] table = new boolean[rows][columns];
            for (int i = 0; i < rows; ++i) {
                String row = next();
                assert row.length() == columns;
                for (int j = 0; j < columns; ++j) {
                    table[i][j] = (row.charAt(j) == trueCharacter);
                }
            }
            return table;
        }

        public char[][] nextCharTable(int rows, int columns) {
            char[][] table = new char[rows][];
            for (int i = 0; i < rows; ++i) {
                table[i] = next().toCharArray();
                assert table[i].length == columns;
            }
            return table;
        }

        public int[][] nextIntTable(int rows, int columns) {
            int[][] table = new int[rows][columns];
            for (int i = 0; i < rows; i++) {
                for (int j = 0; j < columns; j++) {
                    table[i][j] = nextInt();
                }
            }
            return table;
        }

        public long[][] nextLongTable(int rows, int columns) {
            long[][] table = new long[rows][columns];
            for (int i = 0; i < rows; i++) {
                for (int j = 0; j < columns; j++) {
                    table[i][j] = nextLong();
                }
            }
            return table;
        }

        public double[][] nextDoubleTable(int rows, int columns) {
            double[][] table = new double[rows][columns];
            for (int i = 0; i < rows; i++) {
                for (int j = 0; j < columns; j++) {
                    table[i][j] = nextDouble();
                }
            }
            return table;
        }

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

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

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

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String line = readLine();
                if (line == null) {
                    return false;
                }
                tokenizer = new StringTokenizer(line);
            }
            return true;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }
    }
}
