from __future__ import annotations

import math

_UpperCAmelCase          =						"""2020.9.26"""
_UpperCAmelCase          =						"""xcodz-dot, cclaus, dhruvmanila"""




def 							UpperCamelCase		(			__lowercase		:					Union[str, Any]		,__lowercase		:					Dict		,__lowercase		:					Union[str, Any]		,__lowercase		:					Union[str, Any]		,__lowercase		:					str      ):
		'''simple docstring'''




		if not all(isinstance(__snake_case		,(float, int)      ) for val in locals().values()      ):
				A_						:							Optional[int]      = f'''Input values must either be float or int: {list(locals().values()      )}'''
				raise TypeError(__snake_case      )
		A_						:							Optional[int]      = ((x * distance) / (z + distance)) * scale
		A_						:							List[str]      = ((y * distance) / (z + distance)) * scale
		return projected_x, projected_y




def 							UpperCamelCase		(			__lowercase		:					Any		,__lowercase		:					str		,__lowercase		:					Optional[Any]		,__lowercase		:					Optional[int]		,__lowercase		:					List[Any]      ):
		'''simple docstring'''




		if not isinstance(__snake_case		,__snake_case      ):
				raise TypeError('Axis must be a str'      )
		A_						:							List[str]      = locals()
		del input_variables["axis"]
		if not all(isinstance(__snake_case		,(float, int)      ) for val in input_variables.values()      ):
				A_						:							List[str]      = (
				    'Input values except axis must either be float or int: '
				    f'''{list(input_variables.values()      )}'''
				)
				raise TypeError(__snake_case      )
		A_						:							Dict      = (angle % 3_60) / 4_50 * 1_80 / math.pi
		if axis == "z":
				A_						:							Optional[Any]      = x * math.cos(__snake_case      ) - y * math.sin(__snake_case      )
				A_						:							Optional[int]      = y * math.cos(__snake_case      ) + x * math.sin(__snake_case      )
				A_						:							List[str]      = z
		elif axis == "x":
				A_						:							Optional[int]      = y * math.cos(__snake_case      ) - z * math.sin(__snake_case      )
				A_						:							Optional[int]      = z * math.cos(__snake_case      ) + y * math.sin(__snake_case      )
				A_						:							int      = x
		elif axis == "y":
				A_						:							Optional[int]      = x * math.cos(__snake_case      ) - z * math.sin(__snake_case      )
				A_						:							Optional[Any]      = z * math.cos(__snake_case      ) + x * math.sin(__snake_case      )
				A_						:							List[str]      = y
		else:
				raise ValueError('not a valid axis, choose one of \'x\', \'y\', \'z\''      )

		return new_x, new_y, new_z


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	print(F"""{convert_to_ad(1.0, 2.0, 3.0, 10.0, 10.0) = }""")
	print(F"""{rotate(1.0, 2.0, 3.0, 'y', 90.0) = }""")







import sys
from collections import defaultdict
class     lowerCAmelCase_     :







							def __init__(   self      :     Optional[int]		):
												_UpperCamelCase			     =     []







							def  UpperCamelCase_						(   self      :     Any ,			_A      :     str		):
												return self.node_position[vertex]







							def  UpperCamelCase_						(   self      :     Optional[Any] ,			_A      :     List[str] ,			_A      :     Union[str, Any]		):
												_UpperCamelCase			     =     pos







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

																						_UpperCamelCase			     =     self.get_position(positions[smallest_child]		)
																						self.set_position(
																						    positions[smallest_child] ,			self.get_position(positions[start]		)		)
																						self.set_position(positions[start] ,			_A		)

																						self.top_to_bottom(_A ,			_A ,			_A ,			_A		)







							def  UpperCamelCase_						(   self      :     List[str] ,			_A      :     Tuple ,			_A      :     Optional[Any] ,			_A      :     int ,			_A      :     Optional[int]		):
												_UpperCamelCase			     =     position[index]

												while index != 0:
																	_UpperCamelCase			     =     int((index - 2) / 2		) if index % 2 == 0 else int((index - 1) / 2		)

																	if val < heap[parent]:
																						_UpperCamelCase			     =     heap[parent]
																						_UpperCamelCase			     =     position[parent]
																						self.set_position(position[parent] ,			_A		)
																	else:
																						_UpperCamelCase			     =     val
																						_UpperCamelCase			     =     temp
																						self.set_position(_A ,			_A		)
																						break
																	_UpperCamelCase			     =     parent
												else:
																	_UpperCamelCase			     =     val
																	_UpperCamelCase			     =     temp
																	self.set_position(_A ,			0		)







							def  UpperCamelCase_						(   self      :     int ,			_A      :     Tuple ,			_A      :     int		):
												_UpperCamelCase			     =     len(_A		) // 2 - 1
												for i in range(_A ,			-1 ,			-1		):
																	self.top_to_bottom(_A ,			_A ,			len(_A		) ,			_A		)







							def  UpperCamelCase_						(   self      :     Any ,			_A      :     int ,			_A      :     List[str]		):
												_UpperCamelCase			     =     positions[0]
												_UpperCamelCase			     =     sys.maxsize
												self.top_to_bottom(_A ,			0 ,			len(_A		) ,			_A		)
												return temp




def 					_snake_case	(  __snake_case						):
					_UpperCamelCase			     =     Heap()

					_UpperCamelCase			     =     [0] * len(__snake_case						)
					_UpperCamelCase			     =     [-1] * len(__snake_case						)  # Neighboring Tree Vertex of selected vertex
					# Minimum Distance of explored vertex with neighboring vertex of partial tree
					# formed in graph
					_UpperCamelCase			     =     []  # Heap of Distance of vertices from their neighboring vertex
					_UpperCamelCase			     =     []

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

					_UpperCamelCase			     =     []
					_UpperCamelCase			     =     1
					_UpperCamelCase			     =     sys.maxsize
					for neighbor, distance in adjacency_list[0]:
										_UpperCamelCase			     =     0
										_UpperCamelCase			     =     distance
					heap.heapify(__snake_case  ,     __snake_case						)

					for _ in range(1  ,     len(__snake_case						)						):
										_UpperCamelCase			     =     heap.delete_minimum(__snake_case  ,     __snake_case						)
										if visited[vertex] == 0:
															tree_edges.append((nbr_tv[vertex], vertex)						)
															_UpperCamelCase			     =     1
															for neighbor, distance in adjacency_list[vertex]:
																				if (
																				    visited[neighbor] == 0
																				    and distance < distance_tv[heap.get_position(__snake_case						)]
																				):
																									_UpperCamelCase			     =     distance
																									heap.bottom_to_top(
																									    __snake_case  ,     heap.get_position(__snake_case						)  ,     __snake_case  ,     __snake_case						)
																									_UpperCamelCase			     =     vertex
					return tree_edges


if __name__ == "__main__":  # pragma: no cover
					# < --------- Prims Algorithm --------- >
					_lowerCAmelCase       =		int(input("Enter number of edges: ").strip())
					_lowerCAmelCase       =		defaultdict(list)
					for _ in range(edges_number):
										_lowerCAmelCase       =		[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))
