| ??? |
Euclid was a smart guy, and he knew that the age of computers would come some day. He knew people would organize competitions on these computers, and he wanted to contribute something. So he came up with this puzzle.
Input
The input will start with a line giving the number of test cases, N.
Each test case will start with a line giving m, n and
k. Next follow m lines of n positive integers each,
describing an
Output
For each test case, output one line containing "Case #x:"
followed by k lines, each giving the Greatest Common Divisor of
the numbers in the sub-matrix in the corresponding query.
| Sample Input | Sample Output |
4 2 2 3 1 2 3 4 0 1 2 1 1 0 1 2 1 1 1 1 3 3 1 1 2 3 4 5 6 7 8 9 0 2 3 1 0 50 0 2 2 1 1000000000 1000000000 1000000000 1000000000 0 0 2 2 |
Case #1: 2 1 4 Case #2: 3 Case #3: Case #4: 1000000000 |