백준 10825번 국영수

Solution

import sys

si = sys.stdin.readline


class Student:
    def __init__(self, name, korean, english, math):
        self.name = name
        self.korean = korean
        self.english = english
        self.math = math


n = int(si())
students = []

for i in range(n):
    data = si().split()
    data[1:] = map(int, data[1:])
    students.append(Student(*data))

students.sort(key=lambda x: (-x.korean, x.english, -x.math, x.name))

for s in students:
    print(s.name)