


class      UpperCamelCase:


					def __init__(    self						:		Any    )      ->						List[str]:




											'''simple docstring'''

											__snake_case				=		0
											__snake_case				=		0
											__snake_case				=		{}


					def 				SCREAMING_SNAKE_CASE_	(    self						:		List[str]  ,     SCREAMING_SNAKE_CASE						:		Any    )      ->						Optional[int]:




											'''simple docstring'''

											if vertex not in self.adjacency:
																	__snake_case				=		{}
																	self.num_vertices += 1


					def 				SCREAMING_SNAKE_CASE_	(    self						:		int  ,     SCREAMING_SNAKE_CASE						:		Dict  ,     SCREAMING_SNAKE_CASE						:		Any  ,     SCREAMING_SNAKE_CASE						:		Tuple    )      ->						Tuple:




											'''simple docstring'''

											self.add_vertex(SCREAMING_SNAKE_CASE    )
											self.add_vertex(SCREAMING_SNAKE_CASE    )

											if head == tail:
																	return

											__snake_case				=		weight
											__snake_case				=		weight


					def 				SCREAMING_SNAKE_CASE_	(    self						:		str    )      ->						int:




											'''simple docstring'''

											__snake_case				=		self.get_edges()
											for edge in edges:
																	__snake_case		,       __snake_case		,       __snake_case				=		edge
																	edges.remove((tail, head, weight)    )
											for i in range(len(SCREAMING_SNAKE_CASE    )    ):
																	__snake_case				=		list(edges[i]    )

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


					def __str__(    self						:		List[Any]    )      ->						Union[str, Any]:




											'''simple docstring'''

											__snake_case				=		""
											for tail in self.adjacency:
																	for head in self.adjacency[tail]:
																							__snake_case				=		self.adjacency[head][tail]
																							string += f'''{head} -> {tail} == {weight}\n'''
											return string.rstrip("\n"    )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[int]    )      ->						Optional[int]:




											'''simple docstring'''

											__snake_case				=		[]
											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						:		Any    )      ->						Union[str, Any]:




											'''simple docstring'''

											return self.adjacency.keys()


					@staticmethod
					def 				SCREAMING_SNAKE_CASE_	(    SCREAMING_SNAKE_CASE						:		Dict=None  ,     SCREAMING_SNAKE_CASE						:		Tuple=None    )      ->						Tuple:




											'''simple docstring'''

											__snake_case				=		Graph()
											if vertices is None:
																	__snake_case				=		[]
											if edges is None:
																	__snake_case				=		[]
											for vertex in vertices:
																	g.add_vertex(SCREAMING_SNAKE_CASE    )
											for edge in edges:
																	g.add_edge(*SCREAMING_SNAKE_CASE    )
											return g






					class      UpperCamelCase:


										def __init__(    self						:		Any    )      ->						Optional[Any]:




																'''simple docstring'''

																__snake_case				=		{}
																__snake_case				=		{}


										def __len__(    self						:		Optional[int]    )      ->						int:




																'''simple docstring'''

																return len(self.parent    )


										def 				SCREAMING_SNAKE_CASE_	(    self						:		List[str]  ,     SCREAMING_SNAKE_CASE						:		Any    )      ->						List[str]:




																'''simple docstring'''

																if item in self.parent:
																						return self.find(SCREAMING_SNAKE_CASE    )

																__snake_case				=		item
																__snake_case				=		0
																return item


										def 				SCREAMING_SNAKE_CASE_	(    self						:		int  ,     SCREAMING_SNAKE_CASE						:		Optional[int]    )      ->						Optional[Any]:




																'''simple docstring'''

																if item not in self.parent:
																						return self.make_set(SCREAMING_SNAKE_CASE    )
																if item != self.parent[item]:
																						__snake_case				=		self.find(self.parent[item]    )
																return self.parent[item]






										def 				SCREAMING_SNAKE_CASE_	(    self						:		Any  ,     SCREAMING_SNAKE_CASE						:		List[Any]  ,     SCREAMING_SNAKE_CASE						:		Optional[int]    )      ->						Dict:




																'''simple docstring'''

																__snake_case				=		self.find(SCREAMING_SNAKE_CASE    )
																__snake_case				=		self.find(SCREAMING_SNAKE_CASE    )

																if roota == roota:
																						return roota

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

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

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




					@staticmethod
					def 				SCREAMING_SNAKE_CASE_	(    SCREAMING_SNAKE_CASE						:		Dict    )      ->						Tuple:




											'''simple docstring'''

											__snake_case				=		graph.num_vertices

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

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

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









def 						_lowerCAmelCase							(     _lowerCAmelCase = 100			)    ->						int:


						'''simple docstring'''






						__snake_case				=		n * (n + 1) * (2 * n + 1) / 6
						__snake_case				=		(n * (n + 1) / 2) ** 2
						return int(square_of_sum - sum_of_squares			)


if __name__ == "__main__":
	print(f'''{solution() = }''')





