#ABC128B. Guidebook

Guidebook

题目描述

You have decided to write a book introducing good restaurants. There are NN restaurants that you want to introduce: Restaurant 11, Restaurant 22, ......, Restaurant NN. Restaurant ii is in city SiS_i, and your assessment score of that restaurant on a 100100-point scale is PiP_i. 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.

你决定写一本介绍好餐馆的书。您想介绍的餐厅有 NN 家:餐厅 11 、餐厅 22...... 、餐厅 NN 。餐厅 ii 位于城市 SiS_i ,您对该餐厅的 100100 /分评估得分是 PiP_i 。没有两家餐厅的得分相同。

您希望按照以下顺序介绍这些餐馆:

  • 餐厅按其城市名称的词典顺序排列。
  • 如果同一城市有多家餐厅,则按得分降序排列。

按照书中介绍的顺序打印餐厅的标识号。

输入格式

输入内容按以下格式标准输入:

NN
S1S_1 P1P_1
::
SNS_N PNP_N

输出格式

打印 NN 行。 ii1iN1 ≤ i ≤ N )行应包含书中介绍的 iiii )餐厅的标识号。

样例 #1

样例输入 #1

6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40

样例输出 #1

3
4
6
1
5
2

样例 #2

样例输入 #2

10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100

样例输出 #2

10
9
8
7
6
5
4
3
2
1

说明

数据规模与约定

  • 1N1001 ≤ N ≤ 100
  • SS 是长度在 111010 (含)之间的字符串,由小写英文字母组成。
  • 0Pi1000 ≤ P_i ≤ 100
  • PiP_i 是整数。
  • PiPjP_i ≠ P_j (1i<jN)(1 ≤ i \lt j ≤ N)

样例 11 解释

三个城市名称的词法顺序是卡赞 < \lt 哈巴罗夫斯克} < \lt 莫斯科对每个城市的餐馆按得分从高到低的顺序进行介绍。因此,餐厅的介绍顺序为 3,4,6,1,5,23,4,6,1,5,2