
def a__   (	A_,					A_ ):






  '''simple docstring'''





  __magic_name__    					=	sorted(A_,					key=lambda A_ : edge[2] )

  __magic_name__    					=	list(range(A_ ) )

  def find_parent(A_ ):
    if i != parent[i]:
      __magic_name__    					=	find_parent(parent[i] )
    return parent[i]

  __magic_name__    					=	0
  __magic_name__    					=	[]

  for edge in edges:
    __magic_name__    					=	find_parent(edge[0] )
    __magic_name__    					=	find_parent(edge[1] )
    if parent_a != parent_b:
      minimum_spanning_tree_cost += edge[2]
      minimum_spanning_tree.append(A_ )
      __magic_name__    					=	parent_b

  return minimum_spanning_tree


if __name__ == "__main__":  # pragma: no cover
    __lowerCAmelCase	,				__lowerCAmelCase      :					Optional[int]   	=       list(map(int, input().strip().split()))
    __lowerCAmelCase      :					Union[str, Any]   	=       []

    for _ in range(num_edges):
        __lowerCAmelCase	,				__lowerCAmelCase	,				__lowerCAmelCase      :					Optional[Any]   	=       (int(x) for x in input().strip().split())
        edges.append((nodea, nodea, cost))

    kruskal(num_nodes, edges)



class 	UpperCAmelCase_      :


  '''simple docstring'''







  def __init__(			self      :			Tuple      ,							UpperCamelCase__      :			Dict=None   )      ->     List[str]:







    """simple docstring"""






    __magic_name__    					=	data
    __magic_name__    					=	None





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







    """simple docstring"""






    __magic_name__    					=	""""""
    __magic_name__    					=	self
    while temp:
      string_rep += F'''<{temp.data}> ---> '''
      __magic_name__    					=	temp.next
    string_rep += "<END>"
    return string_rep







def a__   (	A_ ):






  '''simple docstring'''





  if not elements_list:
    raise Exception("""The Elements List is empty""" )

  # Set first element as Head
  __magic_name__    					=	Node(elements_list[0] )
  __magic_name__    					=	head
  # Loop through elements from position 1
  for data in elements_list[1:]:
    __magic_name__    					=	Node(A_ )
    __magic_name__    					=	current.next
  return head


__lowerCAmelCase      :					Union[str, Any]   	=       [1, 3, 5, 32, 44, 12, 43]
print(F'''List: {list_data}''')
print('Creating Linked List from List.')
__lowerCAmelCase      :					Optional[Any]   	=       make_linked_list(list_data)
print('Linked List:')





print(linked_list)

