from __future__ import annotations

from typing import Any







class __snake_case    :




			def __init__(   self      :    Dict	,     _lowercase      :    int				):



					"""simple docstring"""






					SCREAMING_SNAKE_CASE__      							=				num_of_nodes
					SCREAMING_SNAKE_CASE__      							=				[]
					SCREAMING_SNAKE_CASE__      							=				{}




			def      __a						(   self      :    Union[str, Any]	,     _lowercase      :    int	,     _lowercase      :    int	,     _lowercase      :    int				):



					"""simple docstring"""






					self.m_edges.append([u_node, v_node, weight]				)




			def      __a						(   self      :    str	,     _lowercase      :    int				):



					"""simple docstring"""






					if self.m_component[u_node] == u_node:
							return u_node
					return self.find_component(self.m_component[u_node]				)




			def      __a						(   self      :    Any	,     _lowercase      :    int				):



					"""simple docstring"""






					if self.m_component[u_node] != u_node:
							for k in self.m_component:
									SCREAMING_SNAKE_CASE__      							=				self.find_component(_lowercase				)




			def      __a						(   self      :    List[str]	,     _lowercase      :    list[int]	,     _lowercase      :    int	,     _lowercase      :    int				):



					"""simple docstring"""






					if component_size[u_node] <= component_size[v_node]:
							SCREAMING_SNAKE_CASE__      							=				v_node
							component_size[v_node] += component_size[u_node]
							self.set_component(_lowercase				)

					elif component_size[u_node] >= component_size[v_node]:
							SCREAMING_SNAKE_CASE__      							=				self.find_component(_lowercase				)
							component_size[u_node] += component_size[v_node]
							self.set_component(_lowercase				)




			def      __a						(   self      :    int				):



					"""simple docstring"""






					SCREAMING_SNAKE_CASE__      							=				[]
					SCREAMING_SNAKE_CASE__      							=				0

					SCREAMING_SNAKE_CASE__      							=				[-1] * self.m_num_of_nodes

					# A list of components (initialized to all of the nodes)
					for node in range(self.m_num_of_nodes				):
							self.m_component.update({node: node}				)
							component_size.append(1				)

					SCREAMING_SNAKE_CASE__      							=				self.m_num_of_nodes

					while num_of_components > 1:
							for edge in self.m_edges:
									SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__      							=				edge

									SCREAMING_SNAKE_CASE__      							=				self.m_component[u]
									SCREAMING_SNAKE_CASE__      							=				self.m_component[v]

									if u_component != v_component:

											for component in (u_component, v_component):
													if (
													    minimum_weight_edge[component] == -1
													    or minimum_weight_edge[component][2] > w
													):
															SCREAMING_SNAKE_CASE__      							=				[u, v, w]

							for edge in minimum_weight_edge:
									if isinstance(_lowercase	,     _lowercase				):
											SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__      							=				edge

											SCREAMING_SNAKE_CASE__      							=				self.m_component[u]
											SCREAMING_SNAKE_CASE__      							=				self.m_component[v]

											if u_component != v_component:
													mst_weight += w
													self.union(_lowercase	,     _lowercase	,     _lowercase				)
													print(f"""Added edge [{u} - {v}]\nAdded weight: {w}\n"""				)
													num_of_components -= 1

							SCREAMING_SNAKE_CASE__      							=				[-1] * self.m_num_of_nodes
					print(f"""The total weight of the minimal spanning tree is: {mst_weight}"""				)





def      __SCREAMING_SNAKE_CASE  ( )							-> None:







		"""simple docstring"""












if __name__ == "__main__":
			import doctest

			doctest.testmod()

def      __SCREAMING_SNAKE_CASE  ( __UpperCamelCase   :	Union[str, Any]     )							-> int:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__      							=				len(__UpperCamelCase     )
  for i in range(length - 1     ):
    SCREAMING_SNAKE_CASE__      							=				i
    for k in range(i + 1			,					__UpperCamelCase     ):
      if collection[k] < collection[least]:
        SCREAMING_SNAKE_CASE__      							=				k
    if least != i:
      SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__      							=				(collection[i], collection[least])
  return collection


if __name__ == "__main__":
   __lowerCamelCase      :			Any							       =		input('''Enter numbers separated by a comma:\n''').strip()
   __lowerCamelCase      :			Dict							       =		[int(item) for item in user_input.split(''',''')]
   print(selection_sort(unsorted))
