You are an avid Ethereum researcher. Recently Ethereum passed a resolution to change the gas rate of a transaction from a value gasPrice to a pair (maxFee,maxPriorityFee). The exact gas price of a transaction is calculated by gasPrice=min(maxFee,maxPriorityFee+baseFee), while baseFee is a parameter that can change over time.
You maintain a dynamic collection of transactions. At some moments, you want to know, for a specific baseFee, what is the largest gasPrice of a transaction in the collection.
Specifically, you need to maintain a collection of transactions that supports the following three operations:
The first line contains an integer t (0≤t≤106) representing the number of operations. For the following t lines, the first integer type on each line represents the type of the current operation.
If type=1, the next two integers are maxFee and maxPriorityFee. You should add a transaction with gas rate (maxFee,maxPriorityFee) to the collection.
If type=2, the next two integers are maxFee and maxPriorityFee. You should remove a single transaction with gas rate (maxFee,maxPriorityFee) from the collection.
If type=3, the next integer is baseFee. You should output the maximum value of gasPrice in the collection when the current base fee is baseFee.
It is guaranteed that all the values of maxFee, maxPriorityFee, and baseFee are integers in range \[0,106].
For each operation with type=3, output a line with an integer representing the current largest gasPrice when the current base fee is baseFee.