Jungyu runs a flower garden. He planted very expensive flowers on a plot of R rows and C columns, and Jinwook kept stealing them, so Jungyu ringed the field with a fence. Parts of that fence broke down over time, and Jinwook is heading back through the gaps.
The garden is a grid of R rows and C columns. A 0 is a cell with no fence, and a flower can be growing there. A 1 is a cell where a fence stands.
Jinwook starts outside the garden. He may enter through any cell on the outer edge of the grid, and inside he moves up, down, left, or right only. To step into a fence cell he has to break that fence, and each broken fence counts as one break. Wherever he can go without breaking a fence he goes without breaking one, and he breaks a fence only when there is no way further in.
Every cell therefore has a fixed minimum number of fences that must be broken to reach it. Among the cells that can hold a flower, the cells with a 0, let D be the largest of those minimums. The flowers a Jinwook who broke D fences takes home are exactly the 0 cells whose minimum equals D. Print D and how many such cells there are.
The first line has the number of test cases T (T≤10).
The first line of each test case has two integers R and C (5≤R,C≤1000). R is the number of rows of the garden and C is the number of columns.
The next R lines describe the garden, C integers per line separated by spaces. A 0 is a cell that can hold a flower and a 1 is a cell with a fence.
The garden has at least one cell with a 0.
For each test case print two integers on one line. The first is D, the largest number of fences Jinwook breaks. The second is how many flowers he gets then. Separate the two integers with a space.
Jinwook goes in without breaking a fence whenever he can. He breaks a fence only when there is no way in at all without breaking one.