Top scores, ties by arrival

entries is a list of (name, score) in the order people finished. Write top_k(entries, k) that returns the names of the k highest scores, highest first; when scores tie, whoever appears earlier in entries comes first. k is at most the number of entries.

top_k([("ana", 7), ("ben", 9), ("cy", 7), ("dee", 9)], 3)  ->  ["ben", "dee", "ana"]

The point is to practise relying on stability: sort by score only and let equal scores keep their input order.

def top_k(entries, k):
    ...