Time Limit: 1000 ms
Memory Limit: 65535 ms
Apple is one of smart boys in my roommates.From his name,we may know he likes computer science.He often finds a vast majority of interesting things about binary numbers.Please look at the following example:
Do you find something in common between matrix A and matrix B ? Yes,Apple finds that matrix B results from matrix A after copying many times.Now you know matrix B,can you tell me the the smallest matrix A? For example:
1010 10 10
(B) (C) (D)
the smallest matrix A is matrix C,not matrix D.
The first line contains an integer t ( 1 <= t <= 10 ): the number of test cases. Then for each test case:The first line contains two integers n,m ( 1 <= n,m <= 1000 ),where n,m is the size of matrix B.Next n lines contain the informations of the matrix B,which only consists of '0' and '1'.
For each test case, output the result in the form of sample.You should print the case number and the size of smallest matrix A and the information of smallest matrix A.