#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param mat int整型二维数组 
# @param n int整型 
# @param m int整型 
# @param x int整型 
# @return int整型一维数组
#
class Solution:
    def findElement(self , mat: List[List[int]], n: int, m: int, x: int) -> List[int]:
        # write code here
        i = n -1
        j = 0
        while i >= 0 and j < m:
            if mat[i][j] == x:
                return [i, j]
            elif x < mat[i][j]:
                i -= 1
            elif x > mat[i][j]:
                j += 1