• + 0 comments

    Added that last comparison for the case if there are multiple maximum score.

    if __name__ == '__main__':
        l = {}
    
        for _ in range(int(input())):
            name = input()
            score = float(input())
    
            if score not in l.keys():
                l[score] = [name]
            else:
                l[score].append(name)
    
        out = sorted(l.items())
    
        for i in range(1, len(out)):
            if out[i][0] != out[i - 1][0]:
                for name in sorted(out[i][1]):
                    print(name)
    
                break