A Day at the Races

No attempts yetTime limit1sMemory limit128 MB

Problem

Formula One is the top class of car racing. A season is a series of races called Grands Prix, in which constructors such as Ferrari and Renault enter one or more cars driven by some of the best drivers in the world. Throughout a season, teams compete in two parallel championships: the drivers' championship and the teams' championship.

In the drivers' championship, each driver tries to score as many points as possible over the season. In every Grand Prix the top eight drivers score 10, 8, 6, 5, 4, 3, 2, and 1 points, from first place to eighth. Drivers are ranked by total points, in decreasing order. When two drivers have the same total, the one with more first-place finishes ranks higher; if they are still tied, the one with more second-place finishes ranks higher, and so on down to eighth-place finishes. If two drivers are still tied after all of that, they are ordered lexicographically, first by last name and then by first name.

After each race, the points a driver scores are added to the pocket of the team the driver raced for. Sponsors may buy drivers from other teams even during the season, so a driver may race for different teams in different Grands Prix; the points always go to the team of that particular race. At the end of the season the team with the most points wins the teams' championship. When two teams have the same total, they are ordered lexicographically by name.

Given the results of one Formula One season, produce both the drivers' standings and the teams' standings.

Input

The input contains one or more data sets, each describing one Formula One season. Every input line is at most 255 characters long.

The first line of a season contains an integer $N$ with $0 < N < 32$, the number of Grands Prix in that season. Each Grand Prix is given as follows:

  • One line with the name of the Grand Prix (at most 64 characters).
  • The table of the top eight finishers, positions 1 through 8. Each data row lists the finishing position, then the driver's first name, last name, and team name.
  • One line containing three dashes (---) marks the end of the Grand Prix.

First names and last names are sequences of printable ASCII characters, contain no spaces, and are at most 12 characters long. A team name is a sequence of printable ASCII characters, at most 18 characters long, and may contain spaces (but no leading or trailing spaces). Each team name is immediately followed by a single period (.), which is not part of the name; trailing whitespace may follow. A row that does not begin with a finishing position (for example, a column header) is not data and is ignored.

The input ends with a line containing a single 0.

Output

For each data set, print a line Season k:, where $k$ is the number of the data set, starting from 1. Then print a line Drivers Standing: followed by the drivers' standings, one driver per line: the first and last name separated by exactly one space, left-justified in a field of width 25, then a single space, then the driver's total points for the season.

Print a blank line, then a line Teams Standing: followed by the teams' standings, one team per line: the team name left-justified in a field of width 25, then a single space, then the team's total points for the season.

Separate consecutive data sets with a blank line. There is no additional blank line after the last data set.