code: 
  
  
  
  
  
  
  from __future__ import annotations
  
  from collections.abc import Iterable, Iterator
  from typing import Any, Generic, TypeVar
  
  __a   				=      TypeVar('''T''', bound=bool)
  
  
  
  
  
  
  
  class 				__SCREAMING_SNAKE_CASE   (			Generic[T]   ):
  
  
        def __init__(							self							,						SCREAMING_SNAKE_CASE__		):
              lowercase			:   T					   =		value
              lowercase			:   SkewNode[T] | None					   =		None
              lowercase			:   SkewNode[T] | None					   =		None
  
  
        @property
        def        __lowerCamelCase			(							self		):
              return self._value
  
  
  
  
  
  
        @staticmethod
        def        __lowerCamelCase			(							SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__		):
              if not roota:
                    return roota
  
              if not roota:
                    return roota
  
              if roota.value > roota.value:
                    lowercase			:   int					   =		roota, roota
  
              lowercase			:   Dict					   =		roota
              lowercase			:   List[Any]					   =		roota.right
              lowercase			:   int					   =		roota.left
              lowercase			:   Optional[int]					   =		SkewNode.merge(SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__		)
  
              return result
  
  
  
  
  
  
  
  class 				__SCREAMING_SNAKE_CASE   (			Generic[T]   ):
  
  
        def __init__(							self							,						SCREAMING_SNAKE_CASE__ = ()		):
              lowercase			:   SkewNode[T] | None					   =		None
              if data:
                    for item in data:
                          self.insert(SCREAMING_SNAKE_CASE__		)
  
  
        def __bool__(							self		):
              return self._root is not None
  
  
        def __iter__(							self		):
              lowercase			:   list[Any]					   =		[]
              while self:
                    result.append(self.pop()		)
  
              # Pushing items back to the heap not to clear it.
              for item in result:
                    self.insert(SCREAMING_SNAKE_CASE__		)
  
              return iter(SCREAMING_SNAKE_CASE__		)
  
  
        def        __lowerCamelCase			(							self							,						SCREAMING_SNAKE_CASE__		):
              lowercase			:   Optional[Any]					   =		SkewNode.merge(self._root							,						SkewNode(SCREAMING_SNAKE_CASE__		)		)
  
  
        def        __lowerCamelCase			(							self		):
              lowercase			:   Dict					   =		self.top()
              lowercase			:   Optional[Any]					   =		(
                  SkewNode.merge(self._root.left							,						self._root.right		) if self._root else None
              )
  
              return result
  
  
        def        __lowerCamelCase			(							self		):
              if not self._root:
                    raise IndexError('''Can\'t get top element for the empty heap.'''		)
              return self._root.value
  
  
  
  
  
  
        def        __lowerCamelCase			(							self		):
              lowercase			:   Any					   =		None
  
  
  if __name__ == "__main__":
    import doctest
  
    doctest.testmod()
  
  
style_context: 
  
  
  __a   				=      [
      [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 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase,    _UpperCamelCase,    _UpperCamelCase     )    ->bool:
  
  
  
  
  
  
  
        """simple docstring"""
  
        return 0 <= row < rows and 0 <= col < cols
  
  
  
  
  def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase,    _UpperCamelCase,    _UpperCamelCase     )    ->int:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Optional[int]					   =		len(_UpperCamelCase     )
        lowercase			:   str					   =		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 			__lowercase	(						_UpperCamelCase     )    ->int:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   set					   =		set()
  
        lowercase			:   Tuple					   =		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
                          lowercase			:   Tuple					   =		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()
  
  