|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||9||6||4||57.143%|
Soccer, or football, is today the biggest sport in the world. According to a study published in 2001, over 240 million people regularly play football in more than 200 countries in every part of the world.
You have been hired to provide IT support for the ACM Soccer League. The rules set for this year in the ACM Soccer League are:
You will be given a list of match results from the ACM Soccer League, and must produce League Table, as defined by the rules above.
The input contains several test cases. The first line of a test case contains a single integer N indicating the number of matches in the test (1 ≤ N ≤ 1000). Each of the following N lines describes the result of a match, in the format
Club1 X x Y Club2
where Club1 and Club2 are strings of at most 15 characters (from ‘a’ to ‘z’ and ‘A’ to ’Z’), X is the number of goals scored by Club1 and Y is the number of goals scored by Club2 (0 ≤ X ≤ 10 and 0 ≤ Y ≤ 10). The end of input is indicated by N = 0.
For each test case in the input your program should output a League Table. Each line of the table must be in the format
where P is the number of points accumulated by the Club. The Clubs must appear in order of descending number of points. If two or more Clubs have the same number of points, the one with largest goal difference must appear first. If two or more teams have the same number of points and the same goal difference, you can choose to output them in any order. You must print a blank line after each table.
3 Warriors 0 x 3 Sundance Sundance 3 x 2 Cats Cats 2 x 2 Warriors 6 Goalies 1 x 1 Wallops Wallops 1 x 1 Guardian Guardian 1 x 1 Goalies Artists 1 x 1 Goalies Artists 1 x 1 Guardian Wallops 1 x 1 Artists 0
6 Sundance 1 Cats 1 Warriors 3 Goalies 3 Wallops 3 Guardian 3 Artists