#C8321. Top Sales Representatives

    ID: 52291 Type: Default 1000ms 256MiB

Top Sales Representatives

Top Sales Representatives

Given sales data for various regions, where each region contains multiple sales representatives along with their sales amounts, determine the top performer in each region. For each region, if two representatives have the same sales amount, choose the one who appears first in the input. The sales amount is compared using the relation \(sale_1 > sale_2\).

inputFormat

The input is provided via standard input (stdin). The first line contains an integer (R) representing the number of regions. For each region, the first line contains the region name (a string) and an integer (N) indicating the number of sales representatives. This is followed by (N) lines, each containing a representative's name and their sales amount (an integer), separated by a space.

outputFormat

For each region (in the same order as input), output one line with the region name, a space, and the name of the top-performing sales representative. The output is written to standard output (stdout).## sample

4
North 3
Alice 5000
Bob 7000
Charlie 6000
South 3
Dave 4000
Eve 3000
Frank 3500
East 2
Grace 8000
Heidi 7000
West 3
Ivan 4500
Judy 5000
Mallory 7000
North Bob

South Dave East Grace West Mallory

</p>