국영수
last update: 2021.09.08.WED
10825 국영수, Silver 4
Memory 85832KB, Time 492ms
import sys
N = int(input())
data = [sys.stdin.readline().split() for i in range(N)]
result = sorted(data, key = lambda x : (-int(x[1]), int(x[2]), -int(x[3]), x[0]))
for i in range(len(result)):
print(result[i][0])