A parking lot has n parking spaces, each with a size si. There are m events, which can be one of three types:
For each event of type 1 (a car entering), assign a parking space based on these rules:
For each car entering operation, output the assigned parking space number. If no space can be assigned, output -1.
The first line contains two positive integers n and m, representing the number of parking spaces and the number of events, respectively.
The second line contains n positive integers s1 ~ sn, representing the size of each parking space.
The next m lines each describe an event in one of three formats:
1 x small/big
: A car of size x with a preference for small (smallest numbered space) or big (largest numbered space) wants to park.
2 y
: The car in parking space y leaves the parking lot.
3 z
: Query how many parking spaces of size z are still available.
For each car entering event, output the assigned parking space number, or -1 if no space can be assigned. For each query event, output the corresponding answer.