#C6077. Student Ranking Competition

    ID: 49797 Type: Default 1000ms 256MiB

Student Ranking Competition

Student Ranking Competition

In this problem, you are given the rankings of N students across M different activities. For each activity, students receive points based on their ranking: if a student is ranked 1st they receive (10) points, if 2nd they receive (5) points, and if 3rd they receive (2) points. All other positions earn no points. The overall score of a student is the sum of points earned from all activities. Students are then ranked in descending order of their total points. In the event of a tie, the student with the lower original index (appearing earlier in the input) is ranked higher. Your task is to output the overall ranking of the students.

inputFormat

Input is provided via standard input. The first line contains two integers (N) and (M), representing the number of students and the number of activities respectively. This is followed by (M) lines, each containing (N) integers. The j-th integer on a line represents the rank of the j-th student in that activity.

outputFormat

Output a single line containing (N) space-separated integers. The i-th integer represents the final ranking position (starting from 1) of the i-th student. The best student receives rank 1.## sample

4 3
1 2 3 4
2 3 4 1
4 1 2 3
2 1 4 3