320_B. Ping-Pong (Easy Version)
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
```python
def main():
    intervals = []
    visited = []
    for _ in range(int(input())):
        read_input(intervals, visited)


def read_input(intervals: list, visited: list) -> None:
    command, x, y = [int(x) for x in input().split(" ")]

    if (command == 1):
        intervals.append((x, y))
        visited.append(False)
    else:
        # reset the visited array
        for idx in range(len(visited)):
            visited[idx] = False

        if(find_path(intervals, visited, x-1, y-1)):
            print("YES")
        else:
            print("NO")


def find_path(intervals: list, visited: list, start: int, end: int) -> bool:

    if (start == end):
        return True
    else:
        for x in range(len(intervals)):
            if (can_move(intervals[start], intervals[x]) and not visited[x]):
                visited[x] = True
                if(find_path(intervals, visited, x, end)):
                    return True

    return False


def can_move(a: tuple, b: tuple) -> bool:
    if (b[0] < a[0] < b[1]):
        return True
    elif (b[0] < a[1] < b[1]):
        return True
    else:
        return False


if __name__ == "__main__":
    main()

```