# Digital Matrix

You are given two N × N square matri- ces, A and B. Each of the elements of these matrices is an integer between 1 and K (inclusive). You have to convert ma- trix A into matrix B in minimum num- ber of operations. In each operation you can choose one element of matrix A and change it to any integer between 1 and K (inclusive). You have to ensure that after any op- eration the matrix is not converted to a symmetric matrix. A square matrix is said to be symmetric if j-th element of i-th row is equal to the i-th element of j- throwforall(i,j)where1≤i≤N and 1 ≤ j ≤ N. For example: Input Input will start with an integer T (T ≤ 200), number of test cases. Each test case starts with a line containing two integers N (1 ≤ N ≤ 100) and K (1 ≤ K ≤ 9). This line will be followed by 2N lines. First N lines will represent matrix A and next N line will represent matrix B. Each of these 2N lines will contain N integers, all of these integers are in between 1 and K (inclusive). Output For each test case, output a single line containing the case number followed by the minimum number of operations required to convert A into B. If it is impossible to convert A into B obeying the rules, print ‘-1’ instead. See output for sample input for exact formatting. Sample Input 3 39 123

2/2 456 789 123 456 789 23 12 11 11 31 23 12 31 13 21 Sample Output Case 1: 0 Case 2: 2 Case 3: 3