403235: GYM101086 G Paradise City
Description
Noura has been looking for a restaurant to host the SCPC2015 celebration in Lattakia, she decided that the best method to pick a restaurant is according to the number of contestants that are living near it. Given a grid representing the map of Lattakia, each 3x3 cells represent a district, each district will consist of 3x3 areas. The center of each district is a restaurant (X), other cells can be:
Help Noura decide which restaurant to choose by finding the maximum number of students living in a district.Input
‘.’ denotes an empty block.
‘*’ denotes a block full of people (4 persons)
The first line of input contains an integer T (1 ≤ T ≤ 256), the number of test cases.
The first line of each test case contains an integer N (1 ≤ N ≤ 100), the number of districts. Then follows three lines, each consists of 3 × N characters, representing the map of the city of N districts.
OutputFor each test case, print the maximum number of students living in a district on a single line.
ExamplesInput3Output
3
***...***
.X.*X*.X.
***...***
2
*.*.*.
.X..X*
*.*.*.
3
.*...****
*X**X**X*
...*..*.*
24Note
16
28
Warning: large Input/Output data, be careful with certain languages.