コードテスト国標解題


李可泰国語数(level 1)解題
N = int(input())
data = []
for i in range(N):
    a, b, c, d = input().split()
    data.append((a, int(b), int(c), int(d)))
data.sort(key = lambda x: (-x[1], x[2], -x[3], x[0]))
for i in range(N):
    print(data[i][0])