Optimal Strategy for the ICPC

Time limit1sMemory limit128 MB

Problem

A three-member team competes in an ICPC-style programming contest. The contest lasts exactly 300 minutes.

The team's score is the sum, over every solved problem, of the time consumed for that problem. The time consumed for a solved problem is the number of minutes from the start of the contest to the submission of its first accepted run, plus 20 penalty minutes for each previously rejected run of that problem. A problem that is not solved contributes nothing.

One element of the optimal strategy is simply to make no incorrect submissions, so the team never has to worry about penalty minutes. All that remains is to decide the order in which the problems are submitted.

Assume the team can estimate the development time required for each problem exactly. The three members each think about a different problem rather than all working on the same one, each member types infinitely fast, and no member uses a terminal while thinking. Hence up to three problems can be in progress at the same time, and all three members may even submit a problem within the same minute.

A problem counts as solved only if it is submitted within the 300 minutes of the contest. Determine a strategy that solves the greatest number of problems and, among those, achieves the best (smallest) possible score. If several strategies solve the same number of problems with the same score, report the submission order that comes first lexicographically.

Input

The first line contains a single integer $n$ ($0 < n < 100$), the number of data sets — one per set of problems. Each of the following $n$ lines describes one data set. The line begins with an integer $k$ ($5 \le k \le 15$), the number of problems in that data set, followed by $k$ integers between $1$ and $300$ inclusive, giving the estimated time required to solve each problem. The problems are labeled with the uppercase letters $A, B, C, \ldots$ in the order given. The contest lasts exactly $300$ minutes.

Output

For each data set, print one line containing, in order: the text Data set X: (where $X$ is the data set number starting from $1$), the labels of the solved problems in the order they are submitted, the total number of problems solved, and the final penalty score. All entries on a line are separated by single spaces.