• + 3 comments

    You mean like this?

    scores = {}
    top2 = []
    
    def logScore(score):
        global top2
        xs = [x for x in top2 if x < score] + [score] + [x for x in top2 if x > score]
        top2 = xs if len(xs) < 3 else xs[0:2]
    
    for _ in range(int(raw_input())):
        name = raw_input()
        score = float(raw_input())
        logScore(score)
        scores[score] = scores.get(score,[]) + [name]
    
    for name in sorted(scores[top2[1]]):
        print name
    

    I think you may have missed the point of what I was commenting on (the solution techniques presented in this thread, not on how I did it).