| Advanced Data Structures |
|---|
| Finished |
A persistent data structure is a data structure in which you can modify and access any previous version of the data structure. The kth query will create version k of the data structure. Your task is to implement a persistent deque, each query copies an old version of the structure and then modifies it. You need to process the following queries:
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 < or >, print the element removed.
Remember to flush the output after every answer.
8
B 0 10
E 0 -10
< 2
> 1
E 2 5
> 5
< 6
< 2
-10
10
5
-10
-10
| Name |
|---|


