| Splay Training |
|---|
| Finished |
Your friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game. At first, the host tells the participant a sequence of numbers, $$$\{A_1, A_2, \ldots A_n\}$$$. Then the host performs a series of operations and queries on the sequence which consists:
To make the show more interesting, the participant is granted a chance to turn to someone else that means when Jackson feels difficult in answering a query he may call you for help. You task is to watch the TV show and write a program giving the correct answer to each query in order to assist Jackson whenever he calls.
The first line contains $$$n$$$ ($$$n \leq 100000$$$).
The following $$$n$$$ lines describe the sequence.
Then follows $$$M$$$ ($$$M \leq 100000$$$), the numbers of operations and queries.
The following $$$M$$$ lines describe the operations and queries.
For each "$$$MIN$$$" query, output the correct answer.
5 1 2 3 4 5 2 ADD 2 4 1 MIN 4 5
5
10 1 2 3 4 5 6 7 8 9 10 15 ADD 4 8 3 MIN 5 7 MIN 7 10 REVERSE 2 5 MIN 2 6 MIN 2 3 INSERT 3 4 MIN 3 4 MIN 5 10 DELETE 6 MIN 3 5 MIN 4 4 REVOLVE 3 6 7 MIN 5 8 MIN 7 10
8 9 2 7 4 2 3 4 7 9
All input fits in 32-bit integers. Every number in the sequence after every operation fits in a 32-bit integer.
| Name |
|---|


