#K85097. Sequence Query Handler

    ID: 36565 Type: Default 1000ms 256MiB

Sequence Query Handler

Sequence Query Handler

You are given a sequence of queries to process on an integer sequence. There are three types of queries:

  • 1 x: Insert an integer x into the sequence.
  • 2 x: Delete the first occurrence of integer x from the sequence, if it exists.
  • 3: Output the minimum integer in the sequence.

For every query of type 3, you need to output the minimum integer currently in the sequence. The operations must be executed in the given order.

Note: It is guaranteed that all queries are valid. If a deletion query (type 2) specifies a number not present in the sequence, simply ignore it.

inputFormat

The input is read from standard input and consists of multiple lines. The first line contains an integer n, the number of queries. Each of the next n lines contains a query in one of the following formats:

  • 1 x — Insert integer x into the sequence.
  • 2 x — Remove the first occurrence of integer x from the sequence.
  • 3 — Print the minimum element in the sequence.

outputFormat

For each query of type 3, output the minimum integer in the sequence on a new line to standard output.

## sample
2
1 5
3
5

</p>