Kick-Tipp

No attempts yetTime limit1sMemory limit128 MB

Problem

During the FIFA World Cup 2006, many people run a World Cup pool, where friends or colleagues predict the outcomes of the tournament's games. The World Cup is split into several rounds, and each round consists of several games.

After each game you earn points for correctly predicting the winner and for predicting the exact score. After each round, whoever scored the most points in that round also earns a dot, which is used later as a tie-breaker; if several people tie for the round's highest score, every one of them earns a dot.

When the tournament ends, the player with the most points overall wins the pot.

You are running such a pool for your friends. The finals are tomorrow, yet you still do not know everyone's standings. Given the participants, their bets, and the actual game results, write a program that computes each participant's total points and dots and prints the standings sorted from best to worst.

Scoring for a single game:

  • 1 point for correctly guessing the result type: team 1 wins, team 2 wins, or a draw.
  • 2 extra points (3 in total) for additionally guessing the exact score.
  • 0 points for guessing the wrong result type.

Input

The first line contains the number of scenarios.

Each scenario begins with a line containing the number of participants pp (1p501 \le p \le 50) and the number of rounds rr (1r141 \le r \le 14). The next pp lines give the participants' names, one per line; the ii-th line is the name of participant ii. Every name is shorter than 50 characters.

Then follow the rr rounds. Each round begins with a line containing the number of games gg (1g161 \le g \le 16) in that round, followed by the gg games.

A game is described by a line with its actual result, followed by exactly pp lines of predictions; the ii-th of these lines is participant ii's prediction. Every result and prediction is written as X : Y (with one space before and after the colon), where XX and YY are non-negative integers.

Output

For each scenario, first print a line Scenario #i:, where ii is the scenario number starting at 1. Then print pp lines, each giving the points, the dots, and the name of a participant, sorted as follows:

  1. A participant with more points ranks higher.
  2. Among participants with equal points, one with more dots ranks higher.
  3. If there is still a tie, keep the input order.

On each line, separate the points, the dots, and the name with single spaces. Print a blank line after each scenario.