#C959. Calculate Highest Scores

    ID: 53699 Type: Default 1000ms 256MiB

Calculate Highest Scores

Calculate Highest Scores

Given multiple test cases, each containing a list of submissions by participants, your task is to compute the highest score achieved by each participant. For each test case, you are provided with an integer n representing the number of submissions, followed by n lines where each line contains a participant's name and an integer score, separated by a space.

You must output, for each test case, a single line containing the participants and their highest scores in lexicographical order of participant names. Each participant and their score should be separated by a space.

The input and output formats are described below. Use standard input (stdin) for reading and standard output (stdout) for printing your answers.

Note: If any formula is needed, write it in \(\LaTeX\) format.

inputFormat

The first line contains an integer T denoting the number of test cases.

For each test case, the first line contains an integer n, which is the number of submissions.

Each of the following n lines contains a participant's name (a string) and a score (an integer), separated by a space.

outputFormat

For each test case, output a single line with the participants and their highest scores. The participants must be listed in lexicographical order, with each name and its corresponding highest score separated by a space.

## sample
1
5
Alice 450
Bob 300
Alice 470
Bob 320
Charlie 500
Alice 470 Bob 320 Charlie 500

</p>