AUCPL Intro


Submit solution

Points: 1
Time limit: 2.0s
C++20 0.01s
Java 0.02s
Python 3 0.04s
Memory limit: 256M

Author:
Problem type

Welcome to the first competition of the Adelaide University Competitive Programming League!

The 8 rounds of competitions held throughout the year will determine the winner of the league, with first place having their name engraved on a trophy.

Leaderboard position is determined by a team's best 6 results, ordered by the total number of problems they have solved. If it's a tie, the winner is the team with the smallest total time to solve questions from their best 6 contests.

Given a list of each team's results, can you find the team name which should be engraved on the trophy?

Note: It is guaranteed that there will be exactly one team which will win the league. If it comes down to tiebreak by smallest total time, exactly one team will have to smallest total time for their best 6 contests.

Input

The first line consists of an integer x (1 \leq x \leq 100), the number of teams.

For each team, there will be the following format in the input:

A string s (1 \leq s.\text{length} \leq 100), the team name,

On the next line, an integer n (1 \leq n \leq 8), the number of AUCPL Rounds they have participated in,

Followed by n lines representing the team's result in a given competition, each consisting of 2 integers, q (1 \leq q \leq 12) and t (0 \leq t \leq 18000), the number of questions solved, and the total time taken to solve the questions in seconds.

Output

Output the name of the team which has solved the most problems in the least amount of time.

Example

Input
3
Alice_team
8
3 1324
2 5786
4 4444
8 10023
5 8852
5 6094
3 4433
7 11670
Bob_team
5
7 10746
7 9898
6 7784
6 4343
7 3362
Charlie_team
5
6 10437
6 8834
8 16775
6 9231
7 7224
Output
Bob_team

Alice_team's best 6 results are:

8 10023
7 11670
5 8852
5 6094
4 4444
3 1324

Which sums up to 32 problems solved in 42407 seconds.

Bob_team has only completed in 6 or less competitions, so all of their scores are summed to 33 solved questions in 36133 seconds.

Charlie_team also has only completed in 6 or less competitions, so all of their scores are summed up to 33 solved questions in 52921 seconds.

Bob_team and Charlie_team both have the most amount of questions solved out of anyone, but since Bob_team has used less total time to solve the same amount of questions, their name is the one that should be engraved.


Comments

There are no comments at the moment.