11541154 SUSTech Online Judge
Problem 1154 --Heap [Easy]

1154: Heap [Easy]

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1220  Solved: 242
[Submit][Status][Web Board]

Description

There is a set with size n initially, and there are q operations, each operation will be one of the following cases:

Add x: add x to this set.

Delete: delete the minimum element of the set.

Query: print the minimum element of the set.

Input

The first line will be an integer T, which is the number of test cases. (1 <= T <= 10).

For each test case, the first line will be an integer n (1 <= n <= 10^5), then the second line will be n integers ai (1<=ai<=10^9), they make up the initial set. The third line will be an integer q (1 <= q <= 10^5), it means the number of operations. Then followed by q lines, each line will be one of the following cases:

1 x: Add x (1<=x<=10^9).

2: Delete.

3: Query.

Output

For each “Query”, print the minimum element of the set in a line.

Sample Input

1
2
2 3
2
1 2
3

Sample Output

2

HINT

Source

[Submit][Status]