#K12176. Top K Participants Selection

    ID: 23633 Type: Default 1000ms 256MiB

Top K Participants Selection

Top K Participants Selection

You are given a list of participants. Each participant is represented by a pair of integers: an ID and a score. Your task is to choose the top k participants based on their scores.

The participants should be sorted primarily by their score in descending order. If two or more participants have the same score, they should be sorted by their ID in ascending order.

Formally, if a participant is represented as \((ID, score)\), you need to select the first \(k\) participants after sorting them according to the following criteria:

[ \text{Sort Order}: \quad (-score, ID) ]

Print the IDs of these top k participants in order, separated by a space.

Example:

Input:
4 2
1 92
2 87
3 92
4 85

Output: 1 3

</p>

inputFormat

The first line of the input contains two integers \(n\) and \(k\), where \(n\) is the number of participants and \(k\) is the number of top participants to select.

The following \(n\) lines each contain two integers: ID and score, separated by a space.

outputFormat

Output a single line containing the IDs of the top \(k\) participants separated by a space, following the sorting criteria described above.

## sample
4 2
1 92
2 87
3 92
4 85
1 3