Number Theory
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
Libra and Rahn are playing a game of number.
Rahn has a set of two-tuples , where and are both non-negative integers. Initially, the set is empty.
Libra has operatons which has three types for Rahn's set:
- Add a two-tuple to Rahn's set.
- Remove a single two-tuple from Rahn's set. It is guaranteed that there is at least one in the set.
- Given a integer , find the maxinum value of , where is an element in Rahn's set. It is guaranteed that there is at least one two-tuple in the set.
Format
Input
The first line contains an integer representing the number of operations. For the following lines, the first integer on each line represents the type of the current operation.
- If , the next two integers are and , representing Libra adds to Rahn's set.
- If , the next two integers are and , representing Libra removes from Rahn's set.
- If , the next integer is . You should output the maximum value of in the set.
It is guaranteed that all the values of are integers in range .
Output
For each operation with , output a line with an integer representing the answer.
Samples
9
1 200000 20000
1 150000 40000
1 120000 50000
1 130000 30000
3 80000
3 100000
3 140000
2 150000 40000
3 100000
120000
140000
160000
130000