{"raw_statement":[{"iden":"statement","content":"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: \n\nThe first line of input contains an integer T (1 ≤ T ≤ 256), the number of test cases.\n\nThe 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.\n\nFor each test case, print the maximum number of students living in a district on a single line.\n\nWarning: large Input/Output data, be careful with certain languages.\n\n"},{"iden":"input","content":"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."},{"iden":"output","content":"For each test case, print the maximum number of students living in a district on a single line."},{"iden":"examples","content":"Input33***...***.X.*X*.X.***...***2*.*.*..X..X**.*.*.3.*...*****X**X**X*...*..*.*Output241628"},{"iden":"note","content":"Warning: large Input/Output data, be careful with certain languages."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, T\\} $:  \n- Let $ N_k \\in \\mathbb{Z} $ denote the number of districts.  \n- Let $ M_k \\in \\{ \\text{char} \\}^{3 \\times (3N_k)} $ be a grid representing the city map, with 3 rows and $ 3N_k $ columns.  \n- Each district corresponds to a contiguous $ 3 \\times 3 $ block in $ M_k $, indexed by $ j \\in \\{1, \\dots, N_k\\} $, where the center cell of district $ j $ is at position $ (2, 3j - 1) $.  \n- Each cell in $ M_k $ contains either:  \n  - `'X'`: denotes the restaurant (center of district),  \n  - `'S'`: denotes a student living in that area,  \n  - `'.'`: empty space.  \n\n**Constraints**  \n1. $ 1 \\le T \\le 256 $  \n2. For each $ k \\in \\{1, \\dots, T\\} $:  \n   - $ 1 \\le N_k \\le 100 $  \n   - $ M_k $ has exactly 3 rows and $ 3N_k $ columns  \n\n**Objective**  \nFor each test case $ k $, compute:  \n$$\n\\max_{j=1}^{N_k} \\left( \\sum_{\\substack{r=1,2,3 \\\\ c=3j-2,3j-1,3j}} \\mathbf{1}_{M_k[r][c] = 'S'} \\right)\n$$  \nOutput this maximum value.","simple_statement":"Given a grid of N districts, each district is a 3x3 area with a restaurant in the center. Count the number of students (non-X characters) in each district, and output the maximum count among all districts.","has_page_source":false}