Portal in Desert

Time Limit: 3 Seconds    Memory Limit: 131072 KB

Lately some strange observations are reported from deserts around Shahed University. The report is mainly about teleportation (the ability to move somewhere else instantly). When astronomy students found the report, they quickly went there to analyze what is happening. They found that, there are some teleportation portals appearing in different moments of a day. Students said that portals have two features x and y denoting some kind of distance that objects can teleport through. An object can travel from portal r to portal q if and only if xq < xr < yq OR xq < yr < yq.

After analysis students made, they could prepare a pattern for births of portals. A new astronomy student has found these pattern interesting and wants to do something more interesting. He wants to know if there is any way to start traveling from a portal and end with another portal in a specific moment of a day, but he is so young to find his answer and asks you to write a program that can provide him the answer. He has prepared a list that specifies births of portals and queries for traveling possibility between portals. Each item in the list consists of 3 space separated sub items; a character and two integers. 2 different kind of items which may appear in his list are as follows:

· b x y: A new portal with distance x to y is created (portal birth). x < y

· q a b: A query to answer – “Is there any way to start traveling from ath portal and end with bth portal according to current structure of portals”. Portals are indexed starting from 1. At birth of each portal, the minimum positive integer which is not used yet, is assigned to it as its index. a != b

Input

First line of input consists of a single integer t, number of test cases.

In the second line of each test, there is single integer n, (1 <= n <= 100) number of items in the list, and the following n lines, denote each list’s item in the format mentioned above.

Output

For each test, give the answer of queries in the list, each in a line by printing “YES” if traveling is possible and “NO” otherwise. Print a blank line after answering all the queries of a test.

Sample Input

2
5
b 1 10
b 11 15
q 1 2
b 5 14
q 1 2
5
b 3 5
b 4 6
b 5 7
q 1 3
q 3 1

Sample Output

NO
YES

YES
YES
Submit