





'''simple docstring'''




from __future__ import annotations

from typing import Any




class       UpperCamelCase__			:




     """simple docstring"""


     def __init__(		self							:	List[str]     ,		lowerCamelCase_							:	List[str]     ,		lowerCamelCase_							:	List[Any]		):  # noqa: A002

       '''simple docstring'''



       SCREAMING_SNAKE_CASE				:							List[str]						=	item
       SCREAMING_SNAKE_CASE				:							str						=	next







class       UpperCamelCase__			:




     """simple docstring"""


     def __init__(		self							:	Optional[Any]		):

       '''simple docstring'''



       SCREAMING_SNAKE_CASE				:							Any						=	None
       SCREAMING_SNAKE_CASE				:							Dict						=	0


     def lowerCamelCase_	(		self							:	Union[str, Any]     ,		lowerCamelCase_							:	Union[str, Any]		):

       '''simple docstring'''



       SCREAMING_SNAKE_CASE				:							Any						=	Node(snake_case_     ,		self.head		)
       self.size += 1


     def lowerCamelCase_	(		self							:	Tuple		):

       '''simple docstring'''



       if self.head is None:
         return None
       else:
         SCREAMING_SNAKE_CASE				:							str						=	self.head.item
         SCREAMING_SNAKE_CASE				:							List[str]						=	self.head.next
         self.size -= 1
         return item


     def lowerCamelCase_	(		self							:	str		):

       '''simple docstring'''



       return self.head is None


     def __str__(		self							:	Any		):

       '''simple docstring'''



       if self.is_empty():
         return ""
       else:
         SCREAMING_SNAKE_CASE				:							Any						=	self.head
         SCREAMING_SNAKE_CASE				:							Any						=	""""""
         SCREAMING_SNAKE_CASE				:							Any						=	[]
         while iterate:
           item_list.append(str(iterate.item		)		)
           SCREAMING_SNAKE_CASE				:							List[str]						=	iterate.next

         SCREAMING_SNAKE_CASE				:							Any						=	""" --> """.join(snake_case_		)

         return item_str



     def __len__(		self							:	str		):

       '''simple docstring'''



       return self.size










'''simple docstring'''




from __future__ import annotations



def 						__A						(       lowerCamelCase_	,	lowerCamelCase_	,	lowerCamelCase_	,	lowerCamelCase_					):


		"""simple docstring"""



		SCREAMING_SNAKE_CASE,    SCREAMING_SNAKE_CASE				:							List[Any]						=	m - 1, 0
		while i >= 0 and j < n:
				if key == mat[i][j]:
						print(f'''Key {key} found at row- {i + 1} column- {j + 1}'''					)
						return
				if key < mat[i][j]:
						i -= 1
				else:
						j += 1
		print(f'''Key {key} not found'''					)



def 						__A						(       ):


		"""simple docstring"""



		SCREAMING_SNAKE_CASE				:							Optional[Any]						=	[[2, 5, 7], [4, 8, 13], [9, 11, 15], [12, 17, 20]]
		SCREAMING_SNAKE_CASE				:							Dict						=	int(input("""Enter the element to be searched:"""					)					)
		print(lowerCamelCase_					)
		search_in_a_sorted_matrix(lowerCamelCase_	,	len(lowerCamelCase_					)	,	len(mat[0]					)	,	lowerCamelCase_					)


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							main()



