Problem Description

You will receive n variables with values. Output the top k variables by value (desc), tie by name (asc). Each name is a string without spaces.

Input Format

Line1: n k. Next n lines: name value.

Output Format

k lines: name value.

Sample Test Case

Input:
5 3 apple 10 bat 5 ant 10 cat 7 dog 7
Output:
ant 10 apple 10 cat 7

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next