#K79062. Maximum Message Rating Finder

    ID: 35225 Type: Default 1000ms 256MiB

Maximum Message Rating Finder

Maximum Message Rating Finder

You are given an integer M representing the total number of message exchanges, followed by M lines. Each line contains three integers: the User ID, the Message ID, and the Rating Value. The rating value is guaranteed to be an integer in the range \(1 \leq r \leq 5\).

Your task is to determine, for each rating value from 1 to 5, the user who has given that particular rating the maximum number of times. In the event of a tie (i.e. multiple users have the same maximum count for a rating), output the smallest user ID. If there are no messages for a particular rating, output No ratings for that rating.

Note: Read the input from standard input (stdin) and write the output to standard output (stdout). The output should consist of 5 tokens separated by a space corresponding to the answers for ratings 1 through 5.

inputFormat

The input is given from standard input in the following format:

M
user_id1 message_id1 rating_value1
user_id2 message_id2 rating_value2
... 
user_idM message_idM rating_valueM

Here, M is the number of message exchanges. Each of the following M lines contains three integers separated by spaces.

outputFormat

Output 5 tokens separated by a single space. Each token corresponds to the user ID who has given the maximum number of messages for rating values 1 through 5 respectively. If there is no message with a particular rating, output No ratings for that rating.

## sample
8
1 101 5
2 102 4
1 103 5
3 104 2
2 105 4
1 106 3
4 107 2
2 108 1
2 3 1 2 1