13305 - Count the wood Ⅱ   

Description

The floor in Winnie the Pooh’s house is made of N row *M column square woods,

When he cleaned the house, he observed that there are two types of wood — 'o' and '#' .

He wants to know the maximum number of consecutive woods with the same type in a row or column or diagonal of each type respectively.

Input

The first line you are given an integer T, means there will be T tests.(1<=T<=10).

Each test you are given integers N, M.

The next lines contains characters('o' or '#').

Note:

Testcase 1: (1 ≤ NM , K≤ 1000) and the diagonal does not affect the answer.

Testcases 2~3: (1 ≤ NM , K≤ 100).

Testcases 4~5: (1 ≤ NM , K≤ 1000).

Output

Each test output the maximun number of consecutive  'o'  woods, the maximun number of consecutive  '#'  woods, and a new line.

Sample Input  Download

Sample Output  Download

Tags




Discuss