- Time limit: 2.00 s
- Memory limit: 512 MB
In this task you are given lines, and have to answer a total of queries of three types.
-
- Activate line with index . It is guaranteed that the line is inactive.
-
- Deactivate line with index . It is guaranteed that the line is active.
-
- What is the lowest value any active line has at a given -coordinate? The value of line at point is . It is guaranteed at least one line is active.
Initially all lines are inactive.
Input
The first line contains two integers : the number of lines and the number of queries.
the second line contains integers .
the third line contains intergets .
lines follow, describing the queries. Each line contains two integers : The query is of type . If or , . If , .
Output
Output the answer to each query of type .
Constraints
Example
Input:
4 12 -1 -2 0 -1 -18 13 4 -14 1 1 3 9 2 1 1 2 3 7 1 4 1 3 1 1 2 1 3 -4 3 10 3 -9
Output:
-27 -1 -10 -24 -5