#CWORLD. A Colorful world

A Colorful world

This is the hardest level of the game. There are n stages in the level. In each stage you will given qi balls. The color of the balls are denoted by an integer between 1 to k. You can pick up not more than one ball in each stage. (You can skip if you want) If you pick up a ball you will gain or lose some points depending on the last ball you have picked. You know color of the available balls of each stage and points you'll get for a certain combination, now can you figure out the maximum point you can get?


Note that you wont gain or lose any point for the first ball you picked. One stage can contain multiple balls of same color.



Input Specification:
First line of input will contain number of test cases T.

In each case first line will contain two integer n and k. Than there will be n lines which describes each stage. Each line contains an integer qi which denotes number of balls available in ith level and then qi integers will denote the colors.

Then there will be a k lines, each containing k integer, jth integer of ith line will indicate the point you will gain or lose if you pick a ball of color j after color i. Negative means you will lose point.


Output Specification:

Print case number and a single integer denoting the maximum point you can get.


Constraints:

T<=120

2<=n<=100

0>=qi<=100

1>=k<=100

point gain or lose in a step will be at most 1000.


Sample Input

2

2 3

3 2 3 2

4 1 1 3 3

1 5 0

1 0 2

-4 1 -5

4 4

1 4

2 3 1

2 2 4

3 4 2 2

-5 -2 3 2

-5 -1 2 0

3 4 5 -4

-3 -5 0 -4


Sample output:

Game 1: 2

Game 2: 4

 

In first case you can pick color 2 in first stage and color 3 in second stage in gain 2 points.