#C1586. Rank Participants by Their Average Scores

    ID: 44807 Type: Default 1000ms 256MiB

Rank Participants by Their Average Scores

Rank Participants by Their Average Scores

In this problem, you are given the scores of (m) participants evaluated by three judges. Each participant's average score is computed using the formula (\frac{s_1+s_2+s_3}{3}). Your task is to rank the participants in descending order based on their average scores. In the case where two participants have the same average score, the one who appears earlier in the input should receive the higher rank. Finally, output the rank of each participant in the order they were given in the input.

inputFormat

The input is read from standard input and has the following format:

  • The first line contains an integer (m) ( (1 \leq m \leq 10^5) ), representing the number of participants.
  • Each of the following (m) lines contains three space-separated integers (s_1), (s_2), and (s_3) ( (0 \leq s_i \leq 100) ) representing the scores given by each of the three judges.

outputFormat

Output a single line on the standard output containing (m) space-separated integers. The (i)-th integer represents the rank of the (i)-th participant in the input order.## sample

4
8 9 7
6 5 8
9 9 10
5 5 5
2 3 1 4