Codeforces Round 189 (Div. 1)
E
Ping-Pong
Codeforces
3000
原题
← D→
翻译中…

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:

翻译中…
  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* ≤ 10^{5})$. Each of the following lines contains a query as described above. All numbers in the input are integers and don't exceed $10^{9}$ 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.

翻译中…

样例

Input #1
5
1 1 5
1 5 11
2 1 2
1 2 9
2 1 2
Output #1
NO
YES
InputCopy OutputCopy
题目信息
题号
319E
时间限制
2 s
内存限制
256 MB
标签
数据结构

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。