• + 0 comments

    from math import inf

    if name == 'main': arr = {} lowest = second = inf for _ in range(int(input())): name = input() score = float(input())

        arr[score] = arr.get(score, []) + [name]
    
        if score < lowest:
            second = lowest
            lowest = score
        elif score < second and score > lowest: second = score
    
    print('\n'.join(sorted(arr[second])))