Олимпиадный тренинг

Задача 45242. Greatest Product of Three Numbers - Search by Sorting


Given an integer  N<=103 and N integers. you need to find three numbers whose product is maximal.

Print the three required numbers in non-increasing order.

Input
The first line is an integer 3 <= N <= 103 - number of elements in the list.
The second line contains N integers  list elements that do not exceed 30000 in absolute value.

Imprint
Print the answer to the problem.
 

Examples
# Input Output
1 9
3 5 1 7 9 0 9 -3 10
10 9 9
2 3
-5 -30000 -12
-5 -12 -30000

Запрещенные операторы:max; min; count; sort