Heap it!#4039

Heap it!

1 second
128 megabytes
Very easy

In this problem you must create a Heap data structure to store the integers, where the following operations are defined:

Input

The first line contains the number of commands (1 \le n \le 10^5), then a sequence of operations, each in a separate line.

Each command has the following format: "0 number" or "1", which means respectively the operations Insert (number) and Extract. The inserted numbers range from to 10^7 inclusive.

It is guaranteed that when the Extract command is executed, there is at least one element in the structure.

Output

For each extraction command, print the number obtained by executing the Extract command.

Examples

Example 1

Loading
Loading