


'''simple docstring'''



class 			a       :


     """simple docstring"""






     def __init__(       self  :	Any    )		->							Union[str, Any]:
          __UpperCAmelCase			:				Any													=    {}

     def 				lowerCamelCase__				(       self  :	Tuple    )		->							None:
          print(self.vertex    )
          for i in self.vertex:
               print(snake_case							,				''' -> '''							,				''' -> '''.join([str(snake_case    ) for j in self.vertex[i]]    )    )

     def 				lowerCamelCase__				(       self  :	Tuple							,				snake_case  :	int							,				snake_case  :	int    )		->							None:
          # check if vertex is already present,
          if from_vertex in self.vertex:
               self.vertex[from_vertex].append(snake_case    )
          else:
               # else make a new vertex
               __UpperCAmelCase			:				Tuple													=    [to_vertex]

     def 				lowerCamelCase__				(       self  :	Tuple    )		->							None:
          # visited array for storing already visited nodes
          __UpperCAmelCase			:				List[Any]													=    [False] * len(self.vertex    )

          # call the recursive helper function
          for i in range(len(self.vertex    )    ):
               if not visited[i]:
                    self.dfs_recursive(snake_case							,				snake_case    )






     def 				lowerCamelCase__				(       self  :	int							,				snake_case  :	int							,				snake_case  :	list    )		->							None:
          # mark start vertex as visited
          __UpperCAmelCase			:				int													=    True

          print(snake_case							,				end=''' '''    )

          # Recur for all the vertices that are adjacent to this node
          for i in self.vertex:
               if not visited[i]:
                    self.dfs_recursive(snake_case							,				snake_case    )


if __name__ == "__main__":
      __UpperCAmelCase    :Union[str, Any]				       =     Graph()
      g.add_edge(0, 1)
      g.add_edge(0, 2)
      g.add_edge(1, 2)
      g.add_edge(2, 0)
      g.add_edge(2, 3)
      g.add_edge(3, 3)

      g.print_graph()
      print("DFS:")
      g.dfs()

      # OUTPUT:
      # 0  ->  1 -> 2
      # 1  ->  2
      # 2  ->  0 -> 3
      # 3  ->  3
      # DFS:
      #  0 1 2 3



'''simple docstring'''



def 			_a			(		_lowercase      :			list[list[int]]    ,      _lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			set						):





     '''simple docstring'''






     __UpperCAmelCase							,     __UpperCAmelCase			:				Any													=    len(_lowercase						), len(grid[0]						)
     if (
         min(_lowercase    ,      _lowercase						) < 0
         or row == row_length
         or col == col_length
         or (row, col) in visit
         or grid[row][col] == 1
     ):
          return 0
     if row == row_length - 1 and col == col_length - 1:
          return 1

     visit.add((row, col)						)

     __UpperCAmelCase			:				Optional[Any]													=    0
     count += depth_first_search(_lowercase    ,      row + 1    ,      _lowercase    ,      _lowercase						)
     count += depth_first_search(_lowercase    ,      row - 1    ,      _lowercase    ,      _lowercase						)
     count += depth_first_search(_lowercase    ,      _lowercase    ,      col + 1    ,      _lowercase						)
     count += depth_first_search(_lowercase    ,      _lowercase    ,      col - 1    ,      _lowercase						)

     visit.remove((row, col)						)
     return count


if __name__ == "__main__":
      import doctest

      doctest.testmod()