The first input line contains a positive integer, n, indicating the number of data sets to be processed. The first line of each data set consists of two positive integers T (T ≤ 30) and G (G ≤
400) – the number of teams in this group and the total number of games played by them. The next line contains T unique names separated by single spaces. Each name is a single uppercase word with no more than 15 characters.
Each of the next G input lines will contain the results of a match. Each line is of the form
. For example, “Greece 2 Nigeria 1” indicates that Greece and Nigeria played a game with score 2-1. All four terms will be separated by single spaces.
At the beginning of output for each data set, output “Group g:” where g is the data set number, starting from 1. Next you should print a single line for each team, ordering teams as mentioned above. For each team, the line you print should be of the form “
”. These items should be separated by single spaces. Leave a blank line after the output for each data set.
2 2 1 KASNIA LATVERIA KASNIA 0 LATVERIA 1 4 6 ENGLAND USA ALGERIA SLOVENIA ENGLAND 1 USA 1 ALGERIA 0 SLOVENIA 1 SLOVENIA 2 USA 2 ENGLAND 0 ALGERIA 0 SLOVENIA 0 ENGLAND 1 USA 1 ALGERIA 0
Group 1: LATVERIA 3 1 0 0 1 0 KASNIA 0 0 1 0 0 1 Group 2: USA 5 1 0 2 4 3 ENGLAND 5 1 0 2 2 1 SLOVENIA 4 1 1 1 3 3 ALGERIA 1 0 2 1 0 2