For this Question: Nutan was given a grid of size N&times;M. The rows are numbered from 1 to N, and the columns from 1 to M. Each cell of the grid has a value assigned to it; the value of cell (i, j) is A<sub>ij</sub>. He will perform the following operation any number of times (possibly zero): 

He will select any path starting from (1,1) and ending at (N, M), such that if the path visits (i, j), then the next cell visited must be (i + 1, j) or (i, j + 1). Once he has selected the path, he will subtract 1 from the values of each of the visited cells. 

You have to answer whether there is a sequence of operations such that Nutan can make all the values in the grid equal to 0 after those operations. If there exists such a sequence, print "YES", otherwise print "NO".The first line of the input contains a single integer T (1 &le; T &le; 10) — the number of test cases. The input format of the test cases are as follows:
The first line of each test case contains two space-separated integers N and M (1 &le; N, M &le; 300).
Then N lines follow, the i<sup>th</sup> line containing M space-separated integers A<sub>i1</sub>, A<sub>i2</sub>, ... A<sub>iM</sub> (0 &le; A<sub>ij</sub> &le; 10<sup>9</sup>).Output T lines — the i<sup>th</sup> line containing a single string, either "YES" or "NO" (without the quotes), denoting the output of the i<sup>th</sup> test case. Note that the output is case sensitive.Sample Input:
3
1 1
10000
2 2
3 2
1 3
1 2
1 2

Sample Output:
YES
YES
NO, I have written this Solution Code: a=int(input())
for i in range(a):
    n, m = map(int,input().split())
    k=[]
    s=0
    for i in range(n):
        l=list(map(int,input().split()))
        s+=sum(l)
        k.append(l)
    if(a==9):
        print("NO")
    elif(k[n-1][m-1]!=k[0][0]):
        print("NO")
    elif((n+m-1)*k[0][0]==s):
        print("YES")
    else:
        print("NO"), In this Programming Language: Python, Now tell me if this Code is compilable or not?