#C7809. Data Structure Query Processor

    ID: 51721 Type: Default 1000ms 256MiB

Data Structure Query Processor

Data Structure Query Processor

You are given an integer n followed by n queries. Each query is in one of the three forms:

  1. add x: Add the integer x to the data structure.
  2. delete x: Remove one occurrence of x from the data structure if it exists; if not, do nothing.
  3. findFirstGreaterThan x: Return the smallest element in the data structure that is strictly greater than x. If such an element does not exist, output "None".

You must process the queries in order and output the result of every findFirstGreaterThan query on a new line. All input is read from standard input (stdin) and all output should be printed to standard output (stdout).

inputFormat

The input starts with an integer n (the number of queries). Then n lines follow, each containing a query command as described above.

outputFormat

The output consists of several lines, each corresponding to the answer for a findFirstGreaterThan query in the order they appear.## sample

8
add 5
add 3
add 7
findFirstGreaterThan 4
delete 3
findFirstGreaterThan 4
delete 5
findFirstGreaterThan 6
5

5 7

</p>