



'''simple docstring'''




class 						_UpperCamelCase  :


			'''simple docstring'''

			def __init__(							self     : Any						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		Union[str, Any]           =		{}

			def UpperCamelCase__					(							self     : Optional[int]						):





					"""simple docstring"""






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

			def UpperCamelCase__					(							self     : List[str]							,     lowerCAmelCase__     : int							,     lowerCAmelCase__     : int						):





					"""simple docstring"""






					if from_vertex in self.vertex:
							self.vertex[from_vertex].append(lowerCAmelCase__						)
					else:
							# else make a new vertex
							__SCREAMING_SNAKE_CASE       :		int           =		[to_vertex]

			def UpperCamelCase__					(							self     : Optional[Any]						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		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(lowerCAmelCase__							,     lowerCAmelCase__						)



			def UpperCamelCase__					(							self     : Optional[int]							,     lowerCAmelCase__     : int							,     lowerCAmelCase__     : list						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE       :		int           =		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__":
						UpperCamelCase__       :	str    = 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'''




UpperCamelCase__       :	Optional[Any]    = [
    (10_00, '''M'''),
    (9_00, '''CM'''),
    (5_00, '''D'''),
    (4_00, '''CD'''),
    (1_00, '''C'''),
    (90, '''XC'''),
    (50, '''L'''),
    (40, '''XL'''),
    (10, '''X'''),
    (9, '''IX'''),
    (5, '''V'''),
    (4, '''IV'''),
    (1, '''I'''),
]


def 				lowerCAmelCase_   (	_lowerCamelCase:   str					):
		__SCREAMING_SNAKE_CASE       :		List[Any]           =		{"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 1_00, """D""": 5_00, """M""": 10_00}
		__SCREAMING_SNAKE_CASE       :		Tuple           =		0
		__SCREAMING_SNAKE_CASE       :		str           =		0
		while place < len(_lowerCamelCase					):
				if (place + 1 < len(_lowerCamelCase					)) and (vals[roman[place]] < vals[roman[place + 1]]):
						total += vals[roman[place + 1]] - vals[roman[place]]
						place += 2
				else:
						total += vals[roman[place]]
						place += 1
		return total


def 				lowerCAmelCase_   (	_lowerCamelCase:   int					):
		__SCREAMING_SNAKE_CASE       :		Any           =		[]
		for arabic, roman in ROMAN:
				((__SCREAMING_SNAKE_CASE)       ,						(__SCREAMING_SNAKE_CASE))       :		str           =		divmod(_lowerCamelCase       ,      _lowerCamelCase					)
				result.append(roman * factor					)
				if number == 0:
						break
		return "".join(_lowerCamelCase					)


if __name__ == "__main__":
						import doctest

						doctest.testmod()