#abc201b. B - Do you know the second highest mountain?

B - Do you know the second highest mountain?

Score : 200200 points

问题描述

在AtCoder共和国境内有NN座山。第ii座山的名字为SiS_i,高度为TiT_i

请返回第二高山的名字。保证所有山的名字和高度均不相同。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

The Republic of AtCoder has NN mountains. The ii-th mountain has a name SiS_i and a height of TiT_i.

Return the name of the second highest mountain there. It is guaranteed that all the mountains have different names and different heights.

Constraints

  • 2N10002 \leq N \leq 1000
  • 1(1 \leq ({}the length of Si)15S_i) \leq 15
  • 1Ti1051 \leq T_i \leq 10^5
  • SiSj (ij)S_i \neq S_j \ (i \neq j)
  • TiTj (ij)T_i \neq T_j \ (i \neq j)
  • SiS_i consists of uppercase English letters, lowercase English letters, and digits.
  • NN and TiT_i are integers.

Input

Input is given from Standard Input in the following format:

NN

S1S_1 T1T_1

S2S_2 T2T_2

\vdots

SNS_N TNT_N

Output

Print the name of the second highest mountain.

Sample Input 1

3
Everest 8849
K2 8611
Kangchenjunga 8586

Sample Output 1

K2

The second highest mountain in the world is K2.

Sample Input 2

4
Kita 3193
Aino 3189
Fuji 3776
Okuhotaka 3190

Sample Output 2

Kita

The second highest mountain in Japan is Kita-dake.

Sample Input 3

4
QCFium 2846
chokudai 2992
kyoprofriends 2432
penguinman 2390

Sample Output 3

QCFium

update @ 2024/3/10 09:12:44