You should implement a list that allows the following operations:
Initially, the list is empty.
All queries are online, that means you should flush the output before reading the input for the following query. Use fflush(stdout) for C/C++.
In the first line an integer Q, the number of queries. Each of the next Q lines has a query, in the format given in the statement.
Limits
For each query of type O, print YES or NO, the value returned. Don't forget to flush the output.
5
< 1
< 2
O 1 2
I 2 10
O 10 1
NO
YES
10
< 1
I 1 2
I 1 3
I 1 4
I 1 5
I 1 6
I 1 7
O 7 6
O 3 7
O 6 4
YES
NO
YES