
"""simple docstring"""


class 					lowerCAmelCase_					:



						'''simple docstring'''


						def __init__(			self  :   Optional[int]   )  -> List[str]:
							A     = 0
							A     = 0
							A     = {}


						def     _SCREAMING_SNAKE_CASE   (			self  :   int	,A_  :   Optional[Any]   )  -> int:
							if vertex not in self.adjacency:
								A     = {}
								self.num_vertices += 1


						def     _SCREAMING_SNAKE_CASE   (			self  :   Optional[Any]	,A_  :   Tuple	,A_  :   Any	,A_  :   str   )  -> Optional[Any]:
							self.add_vertex(A_   )
							self.add_vertex(A_   )

							if head == tail:
								return

							A     = weight
							A     = weight


						def     _SCREAMING_SNAKE_CASE   (			self  :   List[Any]   )  -> Dict:
							A     = self.get_edges()
							for edge in edges:
								A ,   A ,   A     = edge
								edges.remove((tail, head, weight)   )
							for i in range(len(A_   )   ):
								A     = list(edges[i]   )

							edges.sort(key=lambda A_   : e[2]   )
							for i in range(len(A_   ) - 1   ):
								if edges[i][2] >= edges[i + 1][2]:
									A     = edges[i][2] + 1
							for edge in edges:
								A ,   A ,   A     = edge
								A     = weight
								A     = weight


						def __str__(			self  :   Union[str, Any]   )  -> str:
							A     = ''
							for tail in self.adjacency:
								for head in self.adjacency[tail]:
									A     = self.adjacency[head][tail]
									string += F'{head} -> {tail} == {weight}\n'
							return string.rstrip('\n'   )


						def     _SCREAMING_SNAKE_CASE   (			self  :   List[Any]   )  -> int:
							A     = []
							for tail in self.adjacency:
								for head in self.adjacency[tail]:
									output.append((tail, head, self.adjacency[head][tail])   )
							return output


						def     _SCREAMING_SNAKE_CASE   (			self  :   List[Any]   )  -> int:
							return self.adjacency.keys()


						@staticmethod
						def     _SCREAMING_SNAKE_CASE   (			A_  :   Dict=None	,A_  :   int=None   )  -> Tuple:
							A     = Graph()
							if vertices is None:
								A     = []
							if edges is None:
								A     = []
							for vertex in vertices:
								g.add_vertex(A_   )
							for edge in edges:
								g.add_edge(*A_   )
							return g







						class 					lowerCAmelCase_					:



												'''simple docstring'''


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


												def __len__(			self  :   int   )  -> int:
													return len(self.parent   )


												def     _SCREAMING_SNAKE_CASE   (			self  :   List[Any]	,A_  :   Any   )  -> Any:
													if item in self.parent:
														return self.find(A_   )

													A     = item
													A     = 0
													return item


												def     _SCREAMING_SNAKE_CASE   (			self  :   Any	,A_  :   Tuple   )  -> Tuple:
													if item not in self.parent:
														return self.make_set(A_   )
													if item != self.parent[item]:
														A     = self.find(self.parent[item]   )
													return self.parent[item]




												def     _SCREAMING_SNAKE_CASE   (			self  :   Optional[int]	,A_  :   Dict	,A_  :   Optional[Any]   )  -> List[str]:
													A     = self.find(A_   )
													A     = self.find(A_   )

													if roota == roota:
														return roota

													if self.rank[roota] > self.rank[roota]:
														A     = roota
														return roota

													if self.rank[roota] < self.rank[roota]:
														A     = roota
														return roota

													if self.rank[roota] == self.rank[roota]:
														self.rank[roota] += 1
														A     = roota
														return roota
													return None


						@staticmethod
						def     _SCREAMING_SNAKE_CASE   (			A_  :   Any   )  -> Optional[int]:
							A     = graph.num_vertices

							A     = Graph.UnionFind()
							A     = []
							while num_components > 1:
								A     = {}
								for vertex in graph.get_vertices():
									A     = -1

								A     = graph.get_edges()
								for edge in edges:
									A ,   A ,   A     = edge
									edges.remove((tail, head, weight)   )
								for edge in edges:
									A ,   A ,   A     = edge
									A     = union_find.find(A_   )
									A     = union_find.find(A_   )
									if seta != seta:
										if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
											A     = [head, tail, weight]

										if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
											A     = [head, tail, weight]
								for vertex in cheap_edge:
									if cheap_edge[vertex] != -1:
										A ,   A ,   A     = cheap_edge[vertex]
										if union_find.find(A_   ) != union_find.find(A_   ):
											union_find.union(A_	,A_   )
											mst_edges.append(cheap_edge[vertex]   )
											A     = num_components - 1
							A     = Graph.build(edges=A_   )
							return mst



def 							UpperCamelCase_( lowerCamelCase_					)       ->		int:

    if not isinstance(lowerCamelCase_				,					lowerCamelCase_					):
        raise ValueError('multiplicative_persistence() only accepts integral values'					)
    if num < 0:
        raise ValueError('multiplicative_persistence() does not accept negative values'					)

    _lowercase			:				List[str] 						=						0
    _lowercase			:				Optional[int] 						=						str(lowerCamelCase_					)

    while len(lowerCamelCase_					) != 1:
        _lowercase			:				Any 						=						[int(lowerCamelCase_					) for i in num_string]

        _lowercase			:				List[Any] 						=						1
        for i in range(0				,					len(lowerCamelCase_					)					):
            total *= numbers[i]

        _lowercase			:				Optional[Any] 						=						str(lowerCamelCase_					)

        steps += 1
    return steps



def 							UpperCamelCase_( lowerCamelCase_					)       ->		int:

    if not isinstance(lowerCamelCase_				,					lowerCamelCase_					):
        raise ValueError('additive_persistence() only accepts integral values'					)
    if num < 0:
        raise ValueError('additive_persistence() does not accept negative values'					)

    _lowercase			:				Optional[int] 						=						0
    _lowercase			:				str 						=						str(lowerCamelCase_					)

    while len(lowerCamelCase_					) != 1:
        _lowercase			:				Dict 						=						[int(lowerCamelCase_					) for i in num_string]

        _lowercase			:				Any 						=						0
        for i in range(0				,					len(lowerCamelCase_					)					):
            total += numbers[i]

        _lowercase			:				Dict 						=						str(lowerCamelCase_					)

        steps += 1
    return steps


if __name__ == "__main__":
 import doctest

 doctest.testmod()


