|Codeforces Round #189 (Div. 2)|
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 I 1 from our set to interval I 2 from our set if there is a sequence of successive moves starting from I 1 so that we can reach I 2.
Your program should handle the queries of the following two types:
Answer all the queries. Note, that initially you have an empty set of intervals.
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.
For each query of the second type print "YES" or "NO" on a separate line depending on the answer.
1 1 5
1 5 11
2 1 2
1 2 9
2 1 2