LearnPy Hub
← Arena
IntermediateRating 1450

Median So Far

Numbers arrive one at a time. After each, print the median of all numbers so far. With an even count, print the smaller of the two middle numbers.

Input

n, then n integers.

Output

n integers on one line.

Sample 1

Input
5
5 15 1 3 8
Output
5 5 5 3 5

Sample 2

Input
1
4
Output
4
solution.py
Output appears here
Median So Far · Python Arena problem · LearnPy Hub