P13682 [CodeChef] submat
NOI
题目描述

Problem description.
A matrix of dimension mxn containing only 0's and 1's as it elements is given.Determine the maximum possible sub-square matrix containing only 1's as its elements

Input
Input description.

The first line of input contains an integer T,denoting the number of test cases
First line of each test case contains two space separated integers m,n denoting dimensions of matrix as mXn.
Next m lines contains n space separated integers(0's and 1's) .

Output
Output description.

For every test case , output the max possible sub-square matrix dimension.

Constraints

1 ≤ T ≤10^5
1 ≤ m,n ≤ 100

Example
Input:
3
3 3
1 0 0
0 1 0
0 0 1
3 3
0 0 0
0 0 0
0 0 0
4 5
1 0 0 0 0
1 0 1 1 0
0 1 1 1 1
0 1 0 0 0
Output:
1
0
2

Explanation
Example case 3.

输入格式

见题面

输出格式

见题面

样例输入
3 3 3 1 0 0 0 1 0 0 0 1 3 3 0 0 0 0 0 0 0 0 0 4 5 1 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 1 0 0 0
样例输出
1 0 2