[ABC251C] 诗歌评测最佳原创 (Poem Online Judge)
Problem Statement
Poem Online Judge (POJ) is an online judge that gives scores to submitted strings.
There were submissions to POJ. In the -th earliest submission, string was submitted, and a score of was given. (The same string may have been submitted multiple times.)
Note that POJ may not necessarily give the same score to submissions with the same string.
A submission is said to be an original submission if the string in the submission is never submitted in any earlier submission.
A submission is said to be the best submission if it is an original submission with the highest score. If there are multiple such submissions, only the earliest one is considered the best submission.
Find the index of the best submission.
Input
Input is given from Standard Input in the following format:
$N$
$S_1$ $T_1$
$S_2$ $T_2$
$\vdots$
$S_N$ $T_N$
Output
Print the answer.
Example
3
aaa 10
bbb 20
aaa 30
2
Note
-
Constraints:
-
-
is a string consisting of lowercase English characters.
-
has a length between and , inclusive.
-
-
and are integers.
-
Source: ABC251C