Losers Are Winners

Time limit1sMemory limit128 MB

Problem

A local Health and Nutrition Counseling Center is running a contest to encourage overweight couples to lose weight. The prize goes to the two-person team that loses the greatest percentage of their combined starting weight over the course of the contest.

A team's percentage of weight lost is

$$\text{percent lost} = \frac{\text{combined initial weight} - \text{combined final weight}}{\text{combined initial weight}} \times 100.$$

For example, consider the following two teams:

TeamMembers (initial → final)Combined initialCombined final% lost
GreenAmanda 220.6 → 162.5, Ernesto 320.9 → 231.0541.5393.527.3%
OrangePaula 212.0 → 155.1, Eduardo 240.9 → 170.1452.9325.228.2%

Team Orange loses the higher percentage, so Orange wins.

Write a program that processes the weight-loss data and declares the winning team for each contest.

Input

The input consists of several datasets, each describing one contest.

The first line of a dataset is a positive integer $N$, the number of teams in that contest ($1 \le N \le 100$). A line containing $0$ marks the end of the input and is not processed.

The next $2N$ lines each describe one contestant. A line contains four whitespace-separated fields: the contestant's name, the name of the contestant's team, and two floating-point numbers between $50.0$ and $500.0$ giving the contestant's initial weight and final weight, in that order. Each team consists of exactly two members. Names contain only alphabetic characters with no embedded blanks and are at most $100$ characters long. Team names are unique within a dataset; contestant names are not guaranteed to be unique.

Output

For each dataset, print one line: the name of the winning team, a single space, and the percentage of weight the team lost rounded to one decimal place, followed immediately by a percent sign (%).

If two or more teams tie for the greatest percentage lost, print the team whose name comes first in alphabetical order.