#C9747. Managing an Integer Pool with Queries

    ID: 53874 Type: Default 1000ms 256MiB

Managing an Integer Pool with Queries

Managing an Integer Pool with Queries

You are given a series of queries to manage a pool of integers. There are three types of queries:

  • Type 1: Add a given integer to the pool.
  • Type 2: Remove a given integer from the pool if it exists. If the integer occurs multiple times, remove only the first occurrence.
  • Type 3: Output the maximum integer present in the pool. If the pool is empty, output None.

You must process all queries in the given order. For each query of type 3, print the result on a separate line.

Note: The input is provided via standard input and the output must be printed to standard output.

inputFormat

The first line contains an integer n representing the total number of queries.

Each of the following n lines contains two space-separated integers: query_type and value.

It is guaranteed that every query is well-formed, and each query_type is either 1, 2, or 3.

outputFormat

For each query of type 3, output the result on a new line. The result is the maximum integer in the pool at that moment. If the pool is empty, output None.

## sample
5
1 5
1 10
3 0
2 10
3 0
10

5

</p>