Attack on the Ancient (AoTa) is an action real-time strategy game which is very popular among teenagers and adults. The objective of the game is to destroy enemies' building called "The Ancient". The game is played by two teams, fighting each other.
Each month, AoTa teams around the world will compete in the World AoTa Tournament. The final round consists of 8 strong teams, and they will play each other in a round-robin tournament, i.e. each team will play against every other teams. In each match, the two teams will fight to win 2 out of 3 battles. Thus, the score between two teams can only be 2 - 0, 2 - 1, 1 - 2, or 0 - 2; the team who has the score of 2 wins the match.
Given the record of all matches, your task is to determine the rank list. The rank list should be sorted by the number of wins (more wins ranked higher). In the case there is tie, sort them in lexicographical order of the teams' name.
The first 8 lines contains the teams' name. Each team name consists of between 1 and 25 characters, inclusive, and it can only contain alphabetical characters (either lowercase or uppercase) and underscore ('_'). The next 28 lines contains the result of each match with the following format:
<first team's name> <first team's score> - <second team's score> <second team's name>
You may safely assume that there are no two teams with the same name, and each pair of teams only appear once in the match record.
Output the rank list of the given tournament. Each line should has a format of:
<team name> <number of wins>
See the example for clarity.
Water Confidential Noob Fanatic Wicked_Intellectual Visual_Gaming Born_to_Win Simplicity Water 2 - 1 Fanatic Water 2 - 1 Born_to_Win Confidential 0 - 2 Noob Water 0 - 2 Wicked_Intellectual Water 2 - 0 Simplicity Confidential 2 - 1 Wicked_Intellectual Confidential 0 - 2 Visual_Gaming Noob 2 - 0 Visual_Gaming Visual_Gaming 2 - 0 Simplicity Confidential 2 - 0 Born_to_Win Water 2 - 0 Visual_Gaming Confidential 2 - 0 Simplicity Noob 0 - 2 Fanatic Noob 0 - 2 Wicked_Intellectual Fanatic 0 - 2 Visual_Gaming Wicked_Intellectual 2 - 1 Born_to_Win Fanatic 2 - 1 Born_to_Win Noob 0 - 2 Born_to_Win Water 2 - 0 Confidential Confidential 2 - 0 Fanatic Water 1 - 2 Noob Noob 2 - 1 Simplicity Fanatic 2 - 0 Wicked_Intellectual Fanatic 1 - 2 Simplicity Wicked_Intellectual 2 - 0 Simplicity Wicked_Intellectual 2 - 0 Visual_Gaming Visual_Gaming 2 - 0 Born_to_Win Born_to_Win 2 - 1 Simplicity
Water 5 Wicked_Intellectual 5 Confidential 4 Noob 4 Visual_Gaming 4 Fanatic 3 Born_to_Win 2 Simplicity 1
End of Problem