import sys
from collections import defaultdict

class        UpperCamelCase						:





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





						def        A_							(self			,     __UpperCamelCase						)				->				Optional[int]:
												return self.node_position[vertex]





						def        A_							(self			,     __UpperCamelCase			,     __UpperCamelCase						)				->				Dict:
												UpperCamelCase_		:							Union[str, Any]  =		pos





						def        A_							(self			,     __UpperCamelCase			,     __UpperCamelCase			,     __UpperCamelCase			,     __UpperCamelCase						)				->				Tuple:



												if start > size // 2 - 1:
																		return
												else:
																		if 2 * start + 2 >= size:
																								UpperCamelCase_		:							List[str]  =		2 * start + 1
																		else:
																								if heap[2 * start + 1] < heap[2 * start + 2]:
																														UpperCamelCase_		:							Any  =		2 * start + 1
																								else:
																														UpperCamelCase_		:							Optional[Any]  =		2 * start + 2
																		if heap[smallest_child] < heap[start]:
																								UpperCamelCase_,UpperCamelCase_		:							Tuple  =		heap[smallest_child], positions[smallest_child]
																								UpperCamelCase_,UpperCamelCase_		:							int  =		(
																								    heap[start],
																								    positions[start],
																								)
																								UpperCamelCase_,UpperCamelCase_		:							int  =		temp, tempa

																								UpperCamelCase_		:							int  =		self.get_position(positions[smallest_child]						)
																								self.set_position(
																								    positions[smallest_child]			,     self.get_position(positions[start]						)						)
																								self.set_position(positions[start]			,     __lowerCAmelCase						)

																								self.top_to_bottom(__lowerCAmelCase			,     __lowerCAmelCase			,     __lowerCAmelCase			,     __lowerCAmelCase						)





						def        A_							(self			,     __UpperCamelCase			,     __UpperCamelCase			,     __UpperCamelCase			,     __UpperCamelCase						)				->				List[Any]:
												UpperCamelCase_		:							Optional[int]  =		position[index]

												while index != 0:
																		UpperCamelCase_		:							Optional[Any]  =		int((index - 2) / 2						) if index % 2 == 0 else int((index - 1) / 2						)

																		if val < heap[parent]:
																								UpperCamelCase_		:							Dict  =		heap[parent]
																								UpperCamelCase_		:							Optional[Any]  =		position[parent]
																								self.set_position(position[parent]			,     __lowerCAmelCase						)
																		else:
																								UpperCamelCase_		:							Union[str, Any]  =		val
																								UpperCamelCase_		:							int  =		temp
																								self.set_position(__lowerCAmelCase			,     __lowerCAmelCase						)
																								break
																		UpperCamelCase_		:							List[str]  =		parent
												else:
																		UpperCamelCase_		:							Union[str, Any]  =		val
																		UpperCamelCase_		:							Tuple  =		temp
																		self.set_position(__lowerCAmelCase			,     0						)





						def        A_							(self			,     __UpperCamelCase			,     __UpperCamelCase						)				->				List[str]:
												UpperCamelCase_		:							str  =		len(__lowerCAmelCase						) // 2 - 1
												for i in range(__lowerCAmelCase			,     -1			,     -1						):
																		self.top_to_bottom(__lowerCAmelCase			,     __lowerCAmelCase			,     len(__lowerCAmelCase						)			,     __lowerCAmelCase						)





						def        A_							(self			,     __UpperCamelCase			,     __UpperCamelCase						)				->				Tuple:
												UpperCamelCase_		:							List[str]  =		positions[0]
												UpperCamelCase_		:							Union[str, Any]  =		sys.maxsize
												self.top_to_bottom(__lowerCAmelCase			,     0			,     len(__lowerCAmelCase						)			,     __lowerCAmelCase						)
												return temp






def     lowerCAmelCase_			(   _SCREAMING_SNAKE_CASE     :				List[str]			):
						UpperCamelCase_		:							str  =		Heap()

						UpperCamelCase_		:							Any  =		[0] * len(lowerCAmelCase__			)
						UpperCamelCase_		:							int  =		[-1] * len(lowerCAmelCase__			)  # Neighboring Tree Vertex of selected vertex
						# Minimum Distance of explored vertex with neighboring vertex of partial tree
						# formed in graph
						UpperCamelCase_		:							int  =		[]  # Heap of Distance of vertices from their neighboring vertex
						UpperCamelCase_		:							List[str]  =		[]

						for vertex in range(len(lowerCAmelCase__			)			):
												distance_tv.append(sys.maxsize			)
												positions.append(lowerCAmelCase__			)
												heap.node_position.append(lowerCAmelCase__			)

						UpperCamelCase_		:							Dict  =		[]
						UpperCamelCase_		:							Optional[int]  =		1
						UpperCamelCase_		:							Any  =		sys.maxsize
						for neighbor, distance in adjacency_list[0]:
												UpperCamelCase_		:							Union[str, Any]  =		0
												UpperCamelCase_		:							List[Any]  =		distance
						heap.heapify(lowerCAmelCase__		, lowerCAmelCase__			)

						for _ in range(1		, len(lowerCAmelCase__			)			):
												UpperCamelCase_		:							Union[str, Any]  =		heap.delete_minimum(lowerCAmelCase__		, lowerCAmelCase__			)
												if visited[vertex] == 0:
																		tree_edges.append((nbr_tv[vertex], vertex)			)
																		UpperCamelCase_		:							Tuple  =		1
																		for neighbor, distance in adjacency_list[vertex]:
																								if (
																								    visited[neighbor] == 0
																								    and distance < distance_tv[heap.get_position(lowerCAmelCase__			)]
																								):
																														UpperCamelCase_		:							Dict  =		distance
																														heap.bottom_to_top(
																														    lowerCAmelCase__		, heap.get_position(lowerCAmelCase__			)		, lowerCAmelCase__		, lowerCAmelCase__			)
																														UpperCamelCase_		:							List[Any]  =		vertex
						return tree_edges


if __name__ == "__main__":  # pragma: no cover
	# < --------- Prims Algorithm --------- >
	SCREAMING_SNAKE_CASE		:     str         =	int(input("Enter number of edges: ").strip())
	SCREAMING_SNAKE_CASE		:     str         =	defaultdict(list)
	for _ in range(edges_number):
		SCREAMING_SNAKE_CASE		:     str         =	[int(x) for x in input().strip().split()]
		adjacency_list[edge[0]].append([edge[1], edge[2]])
		adjacency_list[edge[1]].append([edge[0], edge[2]])
	print(prisms_algorithm(adjacency_list))







"""simple docstring"""






import torch

from diffusers import StableDiffusionPipeline


__lowerCAmelCase       :			str   	="""path-to-your-trained-model"""
__lowerCAmelCase       :			int   	=StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to("""cuda""")

__lowerCAmelCase       :			Optional[int]   	="""A photo of sks dog in a bucket"""
__lowerCAmelCase       :			int   	=pipe(prompt, num_inference_steps=5_0, guidance_scale=7.5).images[0]

image.save("""dog-bucket.png""")



