Heap#241

Heap

1 second
128 megabytes
Very easy (≈850)

In this problem, you need to build a Heap data structure and perform the following operations:

Input

The first line contains an integer (1 ≤ n ≤ 10^5) indicating the number of operations. Then lines follow, each containing an operation. Each operation is given in the following format:

  • 0 x - adds the number to the Heap (1 \le x \le 10^7).

  • 1 - outputs the maximum element from the Heap (and removes it).

It is guaranteed that the operations will always be valid.

Output

For each Extract operation, output the result on a separate line.

Examples

Example 1

Loading
Loading