






import copy
import re





class __lowerCamelCase :





	"""simple docstring"""






	UpperCamelCase__								=      "hp"
	UpperCamelCase__								=      {}
	UpperCamelCase__								=      None

	@classmethod
	def        UpperCamelCase    (							cls       ,    UpperCAmelCase       ,    UpperCAmelCase    ):
							"""simple docstring"""







							_UpperCAmelCase									=			prefix
							_UpperCAmelCase									=			defaults
							cls.build_naming_info()

	@staticmethod
	def        UpperCamelCase    (							UpperCAmelCase       ,    UpperCAmelCase    ):
							"""simple docstring"""







							if len(UpperCAmelCase    ) == 0:
													return ""
							_UpperCAmelCase									=			None
							if any(char.isdigit() for char in word    ):
													raise Exception(F"""Parameters should not contain numbers: '{word}' contains a number"""    )
							if word in info["short_word"]:
													return info["short_word"][word]
							for prefix_len in range(1       ,    len(UpperCAmelCase    ) + 1    ):
													_UpperCAmelCase									=			word[:prefix_len]
													if prefix in info["reverse_short_word"]:
																			continue
													else:
																			_UpperCAmelCase									=			prefix
																			break

							if short_word is None:
													# Paranoid fallback
													def int_to_alphabetic(UpperCAmelCase    ):
																			_UpperCAmelCase									=			''
																			while integer != 0:
																									_UpperCAmelCase									=			chr(ord('A'    ) + integer % 10    ) + s
																									integer //= 10
																			return s

													_UpperCAmelCase									=			0
													while True:
																			_UpperCAmelCase									=			word + '#' + int_to_alphabetic(UpperCAmelCase    )
																			if sword in info["reverse_short_word"]:
																									continue
																			else:
																									_UpperCAmelCase									=			sword
																									break

							_UpperCAmelCase									=			short_word
							_UpperCAmelCase									=			word
							return short_word

	@staticmethod
	def        UpperCamelCase    (							UpperCAmelCase       ,    UpperCAmelCase    ):
							"""simple docstring"""







							_UpperCAmelCase									=			param_name.split('_'    )

							_UpperCAmelCase									=			[TrialShortNamer.shortname_for_word(UpperCAmelCase       ,    UpperCAmelCase    ) for word in words]

							# We try to create a separatorless short name, but if there is a collision we have to fallback
							# to a separated short name
							_UpperCAmelCase									=			['', '_']

							for separator in separators:
													_UpperCAmelCase									=			separator.join(UpperCAmelCase    )
													if shortname not in info["reverse_short_param"]:
																			_UpperCAmelCase									=			shortname
																			_UpperCAmelCase									=			param_name
																			return shortname

							return param_name

	@staticmethod
	def        UpperCamelCase    (							UpperCAmelCase       ,    UpperCAmelCase    ):
							"""simple docstring"""







							_UpperCAmelCase									=			TrialShortNamer.shortname_for_key(UpperCAmelCase       ,    UpperCAmelCase    )
							_UpperCAmelCase									=			short_name
							_UpperCAmelCase									=			param_name

	@classmethod
	def        UpperCamelCase    (							cls    ):
							"""simple docstring"""







							if cls.NAMING_INFO is not None:
													return

							_UpperCAmelCase									=			{
							    'short_word': {},
							    'reverse_short_word': {},
							    'short_param': {},
							    'reverse_short_param': {},
							}

							_UpperCAmelCase									=			list(cls.DEFAULTS.keys()    )

							for k in field_keys:
													cls.add_new_param_name(UpperCAmelCase       ,    UpperCAmelCase    )

							_UpperCAmelCase									=			info

	@classmethod
	def        UpperCamelCase    (							cls       ,    UpperCAmelCase    ):
							"""simple docstring"""







							cls.build_naming_info()
							assert cls.PREFIX is not None
							_UpperCAmelCase									=			[copy.copy(cls.PREFIX    )]

							for k, v in params.items():
													if k not in cls.DEFAULTS:
																			raise Exception(F"""You should provide a default value for the param name {k} with value {v}"""    )
													if v == cls.DEFAULTS[k]:
																			# The default value is not added to the name
																			continue

													_UpperCAmelCase									=			cls.NAMING_INFO['short_param'][k]

													if isinstance(UpperCAmelCase       ,    UpperCAmelCase    ):
																			_UpperCAmelCase									=			1 if v else 0

													_UpperCAmelCase									=			'' if isinstance(UpperCAmelCase       ,    (int, float)    ) else '-'
													_UpperCAmelCase									=			F"""{key}{sep}{v}"""
													name.append(UpperCAmelCase    )

							return "_".join(UpperCAmelCase    )

	@classmethod
	def        UpperCamelCase    (							cls       ,    UpperCAmelCase    ):
							"""simple docstring"""







							_UpperCAmelCase									=			repr[len(cls.PREFIX    ) + 1 :]
							if repr == "":
													_UpperCAmelCase									=			[]
							else:
													_UpperCAmelCase									=			repr.split('_'    )

							_UpperCAmelCase									=			{}

							for value in values:
													if "-" in value:
																			_UpperCAmelCase					, _UpperCAmelCase									=			value.split('-'    )
													else:
																			_UpperCAmelCase									=			re.sub('[0-9.]'       ,    ''       ,    UpperCAmelCase    )
																			_UpperCAmelCase									=			float(re.sub('[^0-9.]'       ,    ''       ,    UpperCAmelCase    )    )

													_UpperCAmelCase									=			cls.NAMING_INFO['reverse_short_param'][p_k]

													_UpperCAmelCase									=			p_v

							for k in cls.DEFAULTS:
													if k not in parameters:
																			_UpperCAmelCase									=			cls.DEFAULTS[k]

							return parameters


class  lowerCamelCase__							:




	'''simple docstring'''




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







	def    _lowerCamelCase				(					self		:str						)		-> None:
								print(self.vertex						)
								for i in self.vertex:
															print(a     ,   " -> "     ,   " -> ".join([str(a						) for j in self.vertex[i]]						)						)







	def    _lowerCamelCase				(					self		:List[Any]     ,   a		:int     ,   a		:int						)		-> None:
								# check if vertex is already present,
								if from_vertex in self.vertex:
															self.vertex[from_vertex].append(a						)
								else:
															# else make a new vertex
															__UpperCamelCase	:   Optional[Any]			   =					[to_vertex]







	def    _lowerCamelCase				(					self		:Tuple						)		-> None:
								# visited array for storing already visited nodes
								__UpperCamelCase	:   Dict			   =					[False] * len(self.vertex						)

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







	def    _lowerCamelCase				(					self		:Any     ,   a		:int     ,   a		:list						)		-> None:
								# mark start vertex as visited
								__UpperCamelCase	:   int			   =					True

								print(a     ,   end=" "						)

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


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