






"""simple docstring"""




from __future__ import annotations

from collections.abc import Iterator
from typing import Any




class  lowercase_     :






      def __init__(     self  ,  a_						)						->None:







        '''simple docstring'''


        _a					      =						data
        _a					      =						None






      def __str__(     self						)						->str:







        '''simple docstring'''


        return f'''{self.data}'''







class  lowercase_     :






      def __init__(     self						)						->None:







        '''simple docstring'''


        _a					      =						None
        _a					      =						None






      def __iter__(     self						)						->Iterator[Any]:







        '''simple docstring'''


        _a					      =						self.front
        while node:
          yield node.data
          _a					      =						node.next






      def __len__(     self						)						->int:







        '''simple docstring'''


        return len(tuple(iter(self						)						)						)






      def __str__(     self						)						->str:







        '''simple docstring'''


        return " <- ".join(str(a_						) for item in self						)






      def       lowerCamelCase__     (     self						)						->bool:







        '''simple docstring'''


        return len(self						) == 0






      def       lowerCamelCase__     (     self  ,  a_						)						->None:







        '''simple docstring'''


        _a					      =						Node(a_						)
        if self.is_empty():
          _a					      =						_a					      =						node
        else:
          assert isinstance(self.rear  ,  a_						)
          _a					      =						node
          _a					      =						node






      def       lowerCamelCase__     (     self						)						->Any:







        '''simple docstring'''


        if self.is_empty():
          raise IndexError("dequeue from empty queue"						)
        assert isinstance(self.front  ,  a_						)
        _a					      =						self.front
        _a					      =						self.front.next
        if self.front is None:
          _a					      =						None
        return node.data






      def       lowerCamelCase__     (     self						)						->None:







        '''simple docstring'''


        _a					      =						_a					      =						None


if __name__ == "__main__":
     from doctest import testmod

     testmod()










"""simple docstring"""




UpperCamelCase											=     [
    [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
]






def 							lowerCAmelCase			(   UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				int       )							->				bool:







  '''simple docstring'''







  return 0 <= row < rows and 0 <= col < cols






def 							lowerCAmelCase			(   UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				set  ,			UpperCamelCase_:				list[list[int]]       )							->				int:







  '''simple docstring'''







  _a					      =						len(UpperCamelCase_       )
  _a					      =						len(mat[0]       )
  if is_safe(UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       ) and (row, col) not in seen and mat[row][col] == 1:
    seen.add((row, col)       )
    return (
        1
        + depth_first_search(row + 1  ,			UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       )
        + depth_first_search(row - 1  ,			UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       )
        + depth_first_search(UpperCamelCase_  ,			col + 1  ,			UpperCamelCase_  ,			UpperCamelCase_       )
        + depth_first_search(UpperCamelCase_  ,			col - 1  ,			UpperCamelCase_  ,			UpperCamelCase_       )
    )
  else:
    return 0






def 							lowerCAmelCase			(   UpperCamelCase_:				list[list[int]]       )							->				int:







  '''simple docstring'''







  _a					      =						set()

  _a					      =						0
  for row, line in enumerate(UpperCamelCase_       ):
    for col, item in enumerate(UpperCamelCase_       ):
      if item == 1 and (row, col) not in seen:
        # Maximizing the area
        _a					      =						max(UpperCamelCase_  ,			depth_first_search(UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       )       )
  return max_area


if __name__ == "__main__":
     import doctest

     print(find_max_area(matrix))  # Output -> 6
     doctest.testmod()


