Preparando MOJI

Table Bowling

2000ms 65536K

Description:

Table bowling tournament participant completed the competition according to the given final standings table. The table is given as a sequence of lines, each line has a format "name score". Your task is to prepare another table consisting of lines in the form "place name". Sort participant by score (desc.) and by the name lexicographically in the case of a tie. Places are numerated from 1. If more than one participant has some score, all of them share the places and you should output something like "12-14 john".

Please, look into the samples for clarification.

Input:

The first line contains n (1 ≤ n ≤ 100) — the number of rows in the table. Following n lines contain the given table. Each line has the form "name score", where "name" is a sequence of lowercase Latin letters, and "score" — is an integer number between 0 and 1000, inclusive. All the names are distinct. The length of each name is between 1 and 10 characters, inclusive. There is single space between the name and the score in each line.

Output:

Print the required table. Look at the sample outputs for clarifications.

Sample Input:

5
vasya 10
ted 11
petya 10
katya 33
mike 44

Sample Output:

1 mike
2 katya
3 ted
4-5 petya
4-5 vasya

Sample Input:

3
a 1
b 13
c 1

Sample Output:

1 b
2-3 a
2-3 c

Informação

Codeforces

Provedor Codeforces

Código CF64H

Tags

*specialsortings

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 08:29:52

Relacionados

Nada ainda