




"""simple docstring"""





class   a__					:


			def __init__(   self   :     str):


						"""simple docstring"""




						__UpperCAmelCase						:			Tuple												=       {}


			def    a_  (   self   :     List[str]):


						"""simple docstring"""




						print(self.vertex)
						for i in self.vertex:
									print(_lowerCAmelCase   ,	" -> "   ,	" -> ".join([str(_lowerCAmelCase) for j in self.vertex[i]]))


			def    a_  (   self   :     Union[str, Any]   ,	UpperCamelCase_   :     int   ,	UpperCamelCase_   :     int):


						"""simple docstring"""




						if from_vertex in self.vertex:
									self.vertex[from_vertex].append(_lowerCAmelCase)
						else:
									# else make a new vertex
									__UpperCAmelCase						:			str												=       [to_vertex]


			def    a_  (   self   :     Optional[Any]):


						"""simple docstring"""




						__UpperCAmelCase						:			Tuple												=       [False] * len(self.vertex)

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


			def    a_  (   self   :     Tuple   ,	UpperCamelCase_   :     int   ,	UpperCamelCase_   :     list):


						"""simple docstring"""




						__UpperCAmelCase						:			Dict												=       True

						print(_lowerCAmelCase   ,	end=" ")

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


if __name__ == "__main__":
					A				=							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








def    UpperCAmelCase_				( __UpperCAmelCase		:      list     ,     __UpperCAmelCase		:      int     ,     __UpperCAmelCase		:      int = 0     ,     __UpperCAmelCase		:      int = 0				)   ->					int:
      SCREAMING_SNAKE_CASE_      		=     right or len(__UpperCAmelCase				) - 1
      if left > right:
            return -1
      elif list_data[left] == key:
            return left
      elif list_data[right] == key:
            return right
      else:
            return search(__UpperCAmelCase     ,     __UpperCAmelCase     ,     left + 1     ,     right - 1				)


if __name__ == "__main__":
   import doctest

   doctest.testmod()