• + 0 comments
    records = []
    if __name__ == '__main__':
        for _ in range(int(input())):
            name = input()
            score = float(input())
            records.append([name, score])
        
        records.sort(key=lambda x: (x[1], x[0]))
        
        lowest_score = records[0][1]
        
        second_lowest_score = None
        for name, score in records:
            if score > lowest_score:
                second_lowest_score = score
                break
        
        second_lowest_names = [name for name, score in records if score == second_lowest_score]
        
        second_lowest_names.sort()
        
        for name in second_lowest_names:
            print(name)