#K80857. Median Ticket Resolution Time

    ID: 35623 Type: Default 1000ms 256MiB

Median Ticket Resolution Time

Median Ticket Resolution Time

Given a list of tickets, each with a ticket type and a resolution time, compute the median resolution time for each ticket type. The output should be printed with each ticket type in lexicographical order.

The median of a list of numbers \(a_1, a_2, \dots, a_n\) is defined as follows:

$$ \text{median} = \begin{cases} a_{\frac{n+1}{2}} & \text{if } n \text{ is odd}, \\ \frac{a_{\frac{n}{2}} + a_{\frac{n}{2}+1}}{2} & \text{if } n \text{ is even}. \end{cases} $$

Your task is to read the tickets data from standard input, calculate the median resolution time for each ticket type, and then output the results as described.

inputFormat

The input is read from standard input (stdin). The first line contains an integer \(N\), representing the number of tickets. Each of the following \(N\) lines contains a ticket type (a string without spaces) and an integer representing the resolution time, separated by a space.

outputFormat

For each distinct ticket type, print a line containing the ticket type and its median resolution time as a floating-point number with one decimal place, separated by a space. The ticket types must be output in lexicographical order.

## sample
5
billing 30
technical 40
billing 20
technical 60
general 50
billing 25.0

general 50.0 technical 50.0

</p>