• + 0 comments
    stu_list = []
    n= int(input())
    
    # Collecting student names and scores
    for i in range(n):
        name = input()
        score = float(input())
        stu_list.append([name, score])
    
    # Extracting only the scores
    new_list = [x[1] for x in stu_list]
    
    # Finding the second lowest score
    m = sorted(set(new_list))  # Sorting unique scores
    
    # Sorting names alphabetically
    names = sorted([i[0] for i in stu_list if i[1] == m[1]])
    
    # Printing names
    for name in names:
        print(name)
    
    # Printing names
    for name in names:
        print(name)