Rohit is told to find a number in a given N*N matrix. If the number is present in the matrix, then he should print the sum of indices of the first occurrence of that number(when traversed row-wise), else he should print '-1'.(Consider zero-based indexing).
INPUT FORMAT:
OUTPUT FORMAT:
For each test case, print the sum of indices of the first occurrences of X if present, else print '-1'.
Constraints:
0 <= T <= 100
0 <= N <= 20
0 <= X, mat[i][j] <=30.