


The given matrix is Toeplitz:
The first line of the input contains an integer, 'T,’ denoting the number of test cases.
The first line of each test case contains two integers,' N’ and ‘M’ denoting the number of rows and columns.
The next line of each test case has ‘N’ lines that have M values corresponding to the matrix ‘MAT’.
For each test case, print ‘YES’ or ‘NO’ whether the matrix is Toeplitz or not.
Print the output of each test case in a separate line.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 1000.
1 <= M <= 1000.
Time limit: 1 sec
In this approach, we will iterate all the diagonals and if we found any element mismatched, the matrix is not Toeplitz. Otherwise, the matrix is Toeplitz.
If all diagonal elements are identical then they should follow :
MAT[i][j] == MATt[i-1][j-1].