

class      lowerCamelCase_      :




	def __init__(     self						:     int							):
		__A :			int		    =			0
		__A :			Union[str, Any]		    =			0
		__A :			Any		    =			{}




	def        lowerCAmelCase_       (     self						:     List[Any]					,      __A						:     Dict							):
		if vertex not in self.adjacency:
			__A :			List[Any]		    =			{}
			self.num_vertices += 1




	def        lowerCAmelCase_       (     self						:     Optional[Any]					,      __A						:     Tuple					,      __A						:     Union[str, Any]					,      __A						:     Tuple							):
		self.add_vertex(__A							)
		self.add_vertex(__A							)

		if head == tail:
			return

		__A :			Optional[Any]		    =			weight
		__A :			List[Any]		    =			weight




	def        lowerCAmelCase_       (     self						:     str							):
		__A :			Optional[Any]		    =			self.get_edges()
		for edge in edges:
			__A    ,				__A    ,				__A :			int		    =			edge
			edges.remove((tail, head, weight)							)
		for i in range(len(__A							)							):
			__A :			List[str]		    =			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 :			Any		    =			edges[i][2] + 1
		for edge in edges:
			__A    ,				__A    ,				__A :			Any		    =			edge
			__A :			Tuple		    =			weight
			__A :			str		    =			weight




	def __str__(     self						:     Optional[Any]							):
		__A :			List[str]		    =			""""""
		for tail in self.adjacency:
			for head in self.adjacency[tail]:
				__A :			int		    =			self.adjacency[head][tail]
				string += F"""{head} -> {tail} == {weight}\n"""
		return string.rstrip("""\n"""							)




	def        lowerCAmelCase_       (     self						:     Tuple							):
		__A :			List[Any]		    =			[]
		for tail in self.adjacency:
			for head in self.adjacency[tail]:
				output.append((tail, head, self.adjacency[head][tail])							)
		return output




	def        lowerCAmelCase_       (     self						:     List[Any]							):
		return self.adjacency.keys()




	@staticmethod
	def        lowerCAmelCase_       (     __A						:     Dict=None					,      __A						:     Dict=None							):
		__A :			Optional[Any]		    =			Graph()
		if vertices is None:
			__A :			Dict		    =			[]
		if edges is None:
			__A :			int		    =			[]
		for vertex in vertices:
			g.add_vertex(__A							)
		for edge in edges:
			g.add_edge(*__A							)
		return g






	class      lowerCamelCase_      :




		def __init__(     self						:     Any							):
			__A :			int		    =			{}
			__A :			List[Any]		    =			{}




		def __len__(     self						:     Optional[int]							):
			return len(self.parent							)




		def        lowerCAmelCase_       (     self						:     int					,      __A						:     Tuple							):
			if item in self.parent:
				return self.find(__A							)

			__A :			List[Any]		    =			item
			__A :			List[str]		    =			0
			return item




		def        lowerCAmelCase_       (     self						:     Union[str, Any]					,      __A						:     int							):
			if item not in self.parent:
				return self.make_set(__A							)
			if item != self.parent[item]:
				__A :			Optional[Any]		    =			self.find(self.parent[item]							)
			return self.parent[item]




		def        lowerCAmelCase_       (     self						:     List[str]					,      __A						:     Tuple					,      __A						:     List[str]							):
			__A :			Tuple		    =			self.find(__A							)
			__A :			Any		    =			self.find(__A							)

			if roota == roota:
				return roota

			if self.rank[roota] > self.rank[roota]:
				__A :			Union[str, Any]		    =			roota
				return roota

			if self.rank[roota] < self.rank[roota]:
				__A :			Union[str, Any]		    =			roota
				return roota

			if self.rank[roota] == self.rank[roota]:
				self.rank[roota] += 1
				__A :			Union[str, Any]		    =			roota
				return roota
			return None






	@staticmethod
	def        lowerCAmelCase_       (     __A						:     List[str]							):
		__A :			str		    =			graph.num_vertices

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

			__A :			List[str]		    =			graph.get_edges()
			for edge in edges:
				__A    ,				__A    ,				__A :			Dict		    =			edge
				edges.remove((tail, head, weight)							)
			for edge in edges:
				__A    ,				__A    ,				__A :			Optional[int]		    =			edge
				__A :			Tuple		    =			union_find.find(__A							)
				__A :			int		    =			union_find.find(__A							)
				if seta != seta:
					if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
						__A :			Optional[Any]		    =			[head, tail, weight]

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








from __future__ import annotations
def 							__SCREAMING_SNAKE_CASE     (   a__    :   List[str]			,a__    :   Dict			,a__    :   Union[str, Any]			,a__    :   Any       )					->				Optional[int]:  # noqa: E741
	while r - l > 1:
		__A :			Any		    =			(l + r) // 2
		if v[m] >= key:
			__A :			Optional[int]		    =			m
		else:
			__A :			List[Any]		    =			m  # noqa: E741
	return r
def 							__SCREAMING_SNAKE_CASE     (   a__    :   list[int]       )					->				int:
	if len(a__       ) == 0:
		return 0

	__A :			str		    =			[0] * len(a__       )
	__A :			List[str]		    =			1

	__A :			List[Any]		    =			v[0]

	for i in range(1			,len(a__       )       ):
		if v[i] < tail[0]:
			__A :			int		    =			v[i]
		elif v[i] > tail[length - 1]:
			__A :			Union[str, Any]		    =			v[i]
			length += 1
		else:
			__A :			Any		    =			v[i]

	return length


if __name__ == "__main__":
			import doctest

			doctest.testmod()





