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.
t = int(raw_input())

for x in range(t):
	inputs = raw_input()
	inputs = inputs.split(" ")
	m = int(inputs[0])
	n = int(inputs[1])

	city_array = []
	for x in range(m):
		temp = raw_input()
		temp = temp.split(" ")
		city_array.append(temp)


	for x in range(m):
		for y in range(n):
			if city_array[x][y] == '1':
				city_array[x][y] = 1
			else:
				city_array[x][y] = 0

	for x in range(1,m):
		for y in range(1,n):
			if city_array[x][y] == 1:
				city_array[x][y] = min(city_array[x-1][y],city_array[x][y-1],city_array[x-1][y-1]) + 1
			else:
				city_array[x][y] = 0

	max_length = 0
	for x in range(m):
		for y in range(n):
			if city_array[x][y] > max_length:
				max_length = city_array[x][y]

	print(max_length)