Volleyball

Your task in this problem is to find out the classification of volleyball teams in a cup, and also the best teams according to some criterias. You will be given a number of cups, each one with some teams competing. Then, you will be given the matches and their results. A team win a match if it has won 3 sets. There will at most 5 sets per match. There are no draws. A team wins a set if it has made 25 or more points and the other team is at least two points behind. Input The input consists of several cups. Each cup is to be considered alone. Each cup description begins with a line indicating the number of teams competing in that cup, 2 < T < 1000. Than, T lines will follow, each one with the name of one team competing in this cup. Team names are 20 character or less and may contain spaces and letters. Following, there will be a line with 1 < M < 1000 indicating the number of matches already played on this cup. The next M lines will have the description of a single match. Each match description begins with the name of both teams of that match separated by a single dash (-). Following the name of the second team there will be a collon (:). After the name of the teams it will follow the descriptions of the sets played on the match. A set will have the total points of the first team on the set, than a single dash, than the total points of the second team. The input is terminated with a cup where T = 0. This case is not to be considered. Each cup is separated by a blank line. See sample input for the correct format of the input. Output For each cup, print the classification of the cup after the presented matches. The team classification will be according to the following rules, respectively: • The number of winning matches • The number of winning sets less the number of lost sets • The number of points scored If the teams are still tied after considering the criterias above, sort them by their names. Output a blank line after each cup result. Your output must follow the format presented on sample output. Sample Input 3 Team1 Team2 Team 3 3 Team1-Team2: 25-19 25-20 25-23 Team1-Team 3: 1-25 2-25 3-25

2/2 Team2-Team 3: 25-21 31-29 29-31 29-31 33-35 0 Sample Output 1234567890123456789012345678901234567890 ---> Don't print this line, use only as reference Team3 Team1 Team2 24 222 10 81 0 -4 209