100 atcoder#ABC128B. [ABC128B] Guidebook
[ABC128B] Guidebook
Score : points
Problem Statement
You have decided to write a book introducing good restaurants. There are restaurants that you want to introduce: Restaurant , Restaurant , , Restaurant . Restaurant is in city , and your assessment score of that restaurant on a -point scale is . No two restaurants have the same score.
You want to introduce the restaurants in the following order:
- The restaurants are arranged in lexicographical order of the names of their cities.
- If there are multiple restaurants in the same city, they are arranged in descending order of score.
Print the identification numbers of the restaurants in the order they are introduced in the book.
Constraints
- is a string of length between and (inclusive) consisting of lowercase English letters.
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line () should contain the identification number of the restaurant that is introduced -th in the book.
6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40
3
4
6
1
5
2
The lexicographical order of the names of the three cities is kazan
khabarovsk
moscow
. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order .
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100
10
9
8
7
6
5
4
3
2
1