There were n friends. But some of them had problems with others. So, we can say each person has some dissatisfaction with others. And hence we introduce a new term 'Dissatisfaction Factor' and it is described as follows:
You are given all the dissatisfaction factors as dij. dij means the dissatisfaction factor according to person i towards j. If the value is negative that means ith person likes jth person. Positive value means ith person hates jth person. 0 means ith person is neutral about jth person. Obviously dij can be different from dji since ith person may like jth person, but jth person may not like ith person and vice versa.
Now, if you group some people, the dissatisfaction factor is the summation of all the members' dissatisfaction factors towards other people in the group. You have to group them with minimum dissatisfaction factor. You can make as many groups as you like.
Input
Input starts with an integer T (≤ 100), denoting the number of test cases.
Each case starts with a line containing an integer n (2 ≤ n ≤ 14). Each of the next n lines contains n space separated integers. The jth integer in the ith line denotes dij. You can assume that -100 ≤ dij ≤ 100 and of course dii = 0.
Output
For each case, print the case number and the minimum dissatisfaction factor you can make after grouping them.
Sample
Sample Input | Sample Output |
---|---|
3 3 0 2 3 -3 0 5 2 3 0 4 0 -1 -2 -3 1 0 -2 3 1 2 0 -1 2 -2 1 0 2 0 5 1 0 | Case 1: -1 Case 2: -2 Case 3: 0 |