#D4363. Priority Queue
Priority Queue
Priority Queue
Priority queue is a container of elements which the element with the highest priority should be extracted first.
For priority queues () of integers, perform a sequence of the following operations.
- insert(, ): Insert to .
- getMax(): Report the maximum value in . If is empty, do nothing.
- deleteMax(): Delete the maximum element from . If is empty, do nothing.
In the initial state, all queues are empty.
Constraints
Input
The input is given in the following format.
:
Each query is given by
0
or
1
or
2
where the first digits 0, 1 and 2 represent insert, getMax and deleteMax operations respectively.
Output
For each getMax operation, print an integer in a line.
Example
Input
2 10 0 0 3 0 0 9 0 0 1 1 0 2 0 1 0 0 0 4 1 0 0 1 8 1 1
Output
9 3 4 8
inputFormat
Input
The input is given in the following format.
:
Each query is given by
0
or
1
or
2
where the first digits 0, 1 and 2 represent insert, getMax and deleteMax operations respectively.
outputFormat
Output
For each getMax operation, print an integer in a line.
Example
Input
2 10 0 0 3 0 0 9 0 0 1 1 0 2 0 1 0 0 0 4 1 0 0 1 8 1 1
Output
9 3 4 8
样例
2 10
0 0 3
0 0 9
0 0 1
1 0
2 0
1 0
0 0 4
1 0
0 1 8
1 1
9
3
4
8
</p>