Kick-Tipp#2536

Kick-Tipp

1 second
64 megabytes
Easy

With the FIFA World Cup 2006^{\text{TM\textregistered\dagger}}, many people organize pools where friends or colleagues predict the outcome of the games. The World Cup is divided into several rounds, each consisting of several games. After each game, you earn points for correctly predicting the winner or a draw, and additional points for guessing the exact result. After each round, the participant with the highest score receives a dot, which can serve as a tie-breaker. If several participants have the highest score, each receives a dot.

After the World Cup ends, the participant with the highest total score wins the pot or, if you are not playing for money, receives admiration for being such an excellent soccer expert.

A few weeks ago, you decided to organize a pool for your friends. Now, as the World Cup is about to end with the finals tomorrow, you still do not know the scores. You decide to write a program to determine them.

Given a list of participants, their predictions, and the outcomes of the games, calculate each participant's total number of points as well as the number of dots received, and output the sorted list of results.

In your pool, you earn one point for correctly guessing the winner or a draw. If you guess the exact result, you receive two additional points.

Input

The first line contains the number of scenarios. Each scenario begins with a line containing the number of participants (1 \le p \le 50) and the number of rounds (1 \le r \le 14). The next lines each contain the name of the -th participant. Each name is guaranteed to be less than characters. Then follow round descriptions.

Each round starts with a line containing the number of games (1 \le g \le 16) in that round. Next come the game descriptions.

Each game description consists of a line with the result, followed by exactly lines of predictions, where the -th line gives the prediction of participant . Each result is given in the format X : Y (with one space before and after the colon), where and are non-negative integers.

Output

The output for each scenario begins with a line "Scenario #i:", where is the scenario number starting from . Then print a sorted table with lines giving, for each participant, the number of points, the number of dots, and the name, in the following order:

  1. Participants with more points rank higher.

  2. If points are equal, participants with more dots rank higher.

  3. If still tied, use input order.

In each line, the number of points, the number of dots, and the participant's name must be separated by a single space. Terminate the output for each scenario with a blank line.

Examples

Example 1

Loading
Loading