LogiQuest

349. Running Median

HardHeaps

After each new number arrives, print the median of all numbers so far with one decimal place.

Input format

Line 1: n Line 2: n integers

Output format

n medians.

Example 1

Input

6
12 4 5 3 8 7

Output

12.0 8.0 5.0 4.5 5.0 6.0

Example 2

Input

1
5

Output

5.0

Constraints

1 ≤ n ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…