#C14782. Top Three Maximum Numbers

    ID: 44469 Type: Default 1000ms 256MiB

Top Three Maximum Numbers

Top Three Maximum Numbers

Given a list of integers, output the top three maximum numbers in descending order. If the list contains fewer than three elements, output all of them in descending order. Duplicate values are allowed. Formally, if the list is \(\textbf{nums} = [n_1, n_2, \dots, n_k]\), then you need to determine the values \(m_1, m_2, m_3\) (if available) such that \(m_1 \geq m_2 \geq m_3\) and they represent the three highest numbers in the list.

inputFormat

The input consists of two lines. The first line contains an integer \(n\) representing the number of elements in the list. The second line contains \(n\) space‐separated integers.

outputFormat

Print the top three maximum numbers (or all numbers if fewer than three) in descending order, separated by a space. If the list is empty, output nothing.

## sample
3
3 1 2
3 2 1