#K88282. Participant Categorization Challenge

    ID: 37274 Type: Default 1000ms 256MiB

Participant Categorization Challenge

Participant Categorization Challenge

This problem requires you to categorize participants into different age groups based on their ages and then determine the top three participants in each group by their completion times.

The four age groups are defined as follows:

\(\text{Group 1: }18 \leq \text{age} \leq 25\)

\(\text{Group 2: }26 \leq \text{age} \leq 35\)

\(\text{Group 3: }36 \leq \text{age} \leq 45\)

\(\text{Group 4: }\text{age} \geq 46\)

For each group, you must sort the completion times in ascending order and then select the top three (i.e. the smallest three values). If a group has fewer than three participants, output all available completion times.

Your program should read input from standard input (stdin) and output the result to standard output (stdout) in the format described below.

inputFormat

The input is read from stdin. The first line contains an integer \(n\) representing the number of participants. Each of the following \(n\) lines contains two space-separated integers: the first is the completion time and the second is the participant's age.

outputFormat

Output the categorization result in four lines. Each line corresponds to one of the groups in the order: Group 1, Group 2, Group 3, and Group 4. For each line, print the group title followed by a colon and a space, then the top three (or fewer) completion times in ascending order separated by a space. If a group has no participants, print only the group title and colon.

## sample
10
120 22
90 19
110 23
130 25
140 28
150 34
160 35
170 40
180 46
190 50
Group 1: 90 110 120

Group 2: 140 150 160 Group 3: 170 Group 4: 180 190

</p>