Given a binary matrix, whose all elements are either 0 or 1, you need to find the size of largest sub-rectangle, all of whose elements are 1.
This is a classical problem that is discussed in several tutorials across the web. Rahul and Rashi, out of their usual curosity, want to tweak the problem.
Rahul asserts that if we are allowed to re-arrange the rows beforehand, a better solution can be found. On the contrary, Rashi is more inclined towards a similar tweak that allows to re-arrange the columns.
You, being smarter than both of them, are going to end the dispute by finding the corresponding answer in both situations.
Input :
The first line of each test case contains an integer T, denoting the test cases to follow.
Each of the next T lines contain one test case, The first line of each test case contains integers R and C denoting the number of rows and columns in the binary matrix, respectively. The next R lines each lines each contain C characters denoting a row of the matrix.
Output :
Output exactly T lines, each containing answer for corresponding query.
For each query, output two integers, separated by a single space that represent Rahul's and Rashi's answer, respectively.
Constraints:
1 ≤ T ≤ 300
1 ≤ R, C ≤ 1000
The sum of sizes of input matrices, never exceeds 3*106.
We can swap the column 2 with column 3 (1-based indexing), to achieve following matrix: 111 110
Clearly, a submtarix of size 2x2 i.e. 4 can be obtained.