#K886. Task Prioritization

    ID: 37344 Type: Default 1000ms 256MiB

Task Prioritization

Task Prioritization

You are given a list of tasks, each comprising a task description and its priority. The priority is one of the three levels: (\texttt{high}), (\texttt{medium}), or (\texttt{low}). Your task is to sort the tasks in descending order of their importance such that tasks with priority (\texttt{high}) come first, followed by (\texttt{medium}), and then (\texttt{low}).

The relation between the priorities can be expressed by the following ordering in (\LaTeX):
[ \texttt{high} < \texttt{medium} < \texttt{low} ]

Read the list of tasks from the standard input and output the sorted list to the standard output.

inputFormat

Input is read from standard input (stdin). The first line contains an integer (n) which denotes the number of tasks. Each of the following (n) lines contains a task description and its priority, separated by a comma. You may assume that the task description does not contain any commas.

outputFormat

Output the sorted tasks to standard output (stdout), one task per line. Each line should contain the task description and its priority separated by a comma, following the sorted order based on descending priority (i.e. high, then medium, then low).## sample

5
clean,medium
wash dishes,high
do laundry,low
pay bills,high
do homework,medium
wash dishes,high

pay bills,high clean,medium do homework,medium do laundry,low

</p>