PAT 乙级 1004

代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: a2htray
# create date: 2023/3/1

"""
PAT 乙级 1004
"""


def get_score(student):
    return student[2]


if __name__ == '__main__':
    n = int(input())

    students = []
    while n != 0:
        tokens = input().split(' ')
        students.append((tokens[0], tokens[1], int(tokens[2])))
        n -= 1

    students.sort(key=get_score)

    print(students[len(students) - 1][0], students[len(students) - 1][1])
    print(students[0][0], students[0][1])