Small John is playing a dice stacking game. Six faces of a die are squares of the same size; each face of a die has a number range from 1 to 6.
The first line of the input contains a single integer t, the number of test cases, followed by the input data for each test case. The first line for each test case contains an integer n (1 <= n <= 10), the number of dice. In the next lines, each line contains six integers for a die, by the order A, B, C, D, E, F, as in the following figure. There is a single space between two numbers.
There should be one line per test case, which contains the maximum sum of the numbers in one side. If you cannot stack all the dice up, simply output 0 in a line.
1 5 2 3 1 6 5 4 3 1 2 4 6 5 5 6 4 1 3 2 1 3 6 2 4 5 4 1 6 5 2 2
30