For this Question: Nutan is a college student. Nutan arrived at college and listened to his friends discussing 'loyal' numbers in a matrix. But Nutan had no idea what 'loyal' numbers were, so he asked his friends. A 'loyal' number, according to one of his friends, is a matrix element that is the smallest in its row and the largest in its column.
Now it's time to test Nutan's understanding. He is given a m x n matrix of distinct numbers and is asked to return all ‘loyal’ numbers in any order.
As a friend of Nutan, help him to solve the problem.The first line contains the numbers of rows r and number of columns c as space separated.
For the next r lines, contains the c elements of the matrix each line as a space separated.

<b>Constraints</b>
m == mat. length
n == mat[i]. length
1 <= n, m <= 10
-100 <= matrix[i][j] <= 100.
All elements in the matrix are distinct.Print the elements of the array containing the loyal numbers in a single line space separated, if it's not present then print -1.Sample Input
2 2
7 8
1 2
Sample Output 
7
Explanation
7 is the only loyal number since it is the minimum in its row and the maximum in its column., I have written this Solution Code: m,n = list(map(int,input().split()))
mat = []
for i in range(m):
    mat.append(list(map(int,input().split())))
loyal = []
i = 0
for i in range(m):
    flag = 0
    index = mat[i].index(min(mat[i]))
    max_val = min(mat[i])
    for j in mat:
        if j[index]>max_val:
            flag = 1
            break
    if flag==0:
        loyal.append(max_val)
if loyal==[]:
    print(-1)
else:
    print(*loyal), In this Programming Language: Python, Now tell me if this Code is compilable or not?