Given an initially empty heap, you are asked to perform q queries. There are 3 types of queries:

add x - should add x to the heap

pop - should delete the root of the heap

max - should print the maximum element of the heap

Input

The first line of the input contains a single integer q (1 ≤ q ≤ 10^5).

The next q lines contain queries - each on a separate line. It’s guaranteed that for all add queries the value of x does not exceed in absolute value. It’s guaranteed that all the operations are valid and there are no pop operations on an empty heap.

Output

The program should print the appropriate values for all the max queries on separate lines.