#C48. Most Popular Programming Language

    ID: 48377 Type: Default 1000ms 256MiB

Most Popular Programming Language

This problem requires you to determine the most popular programming language based on its given popularity score. For each test case, you are provided with an integer N representing the number of programming languages in that test case, followed by N lines each containing a language name and its corresponding integer popularity score. In the case of a tie (i.e. when multiple languages have the same highest score), the language that appears first in the input should be selected.

Formally, let each test case be represented as a sequence of pairs \((language, score)\). Your task is to output, for each test case, the language \(L\) such that

\[ L = \text{language} \quad \text{if} \quad score = \max(score_1, score_2, \ldots, score_N) \quad \text{and in case of ties, the first occurrence is chosen.} \]

inputFormat

The input is given in the following format:

T
N1
language1 score1
language2 score2
... (N1 lines)
N2
language1 score1
language2 score2
... (N2 lines)
...

Where T is the number of test cases. For each test case, the first line contains an integer N representing the number of languages, and the next N lines each contain a language name (a string without spaces) and an integer score, separated by a space.

outputFormat

For each test case, output the most popular programming language on a new line.

## sample
4
3
Python 95
JavaScript 80
Java 95
2
C++ 85
PHP 85
1
Go 70
3
Ruby 50
Scala 50
Swift 50
Python

C++ Go Ruby

</p>