


class 				A       :
					'''simple docstring'''






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




							"""simple docstring"""


							lowercase__	     =						0
							lowercase__	     =						0
							lowercase__	     =						{}

					def     lowerCamelCase__	(self       :		Optional[int] ,   _UpperCAmelCase       :		List[Any]						)		->  Union[str, Any]:




							"""simple docstring"""


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

					def     lowerCamelCase__	(self       :		Dict ,   _UpperCAmelCase       :		Any ,   _UpperCAmelCase       :		Union[str, Any] ,   _UpperCAmelCase       :		int						)		->  int:




							"""simple docstring"""


							self.add_vertex(lowerCAmelCase__						)
							self.add_vertex(lowerCAmelCase__						)

							if head == tail:
									return

							lowercase__	     =						weight
							lowercase__	     =						weight

					def     lowerCamelCase__	(self       :		Optional[int]						)		->  List[str]:




							"""simple docstring"""


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

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

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




							"""simple docstring"""


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

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




							"""simple docstring"""


							lowercase__	     =						[]
							for tail in self.adjacency:
									for head in self.adjacency[tail]:
											output.append((tail, head, self.adjacency[head][tail])						)
							return output

					def     lowerCamelCase__	(self       :		Optional[int]						)		->  List[Any]:




							"""simple docstring"""


							return self.adjacency.keys()

					@staticmethod
					def     lowerCamelCase__	(_UpperCAmelCase       :		Optional[int]=None ,   _UpperCAmelCase       :		List[str]=None						)		->  Optional[int]:




							"""simple docstring"""


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



					class 				A       :
										'''simple docstring'''






										def __init__(self       :		Dict						)		->  Any:




												"""simple docstring"""


												lowercase__	     =						{}
												lowercase__	     =						{}

										def __len__(self       :		Any						)		->  List[Any]:




												"""simple docstring"""


												return len(self.parent						)

										def     lowerCamelCase__	(self       :		Union[str, Any] ,   _UpperCAmelCase       :		Optional[Any]						)		->  Dict:




												"""simple docstring"""


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

												lowercase__	     =						item
												lowercase__	     =						0
												return item

										def     lowerCamelCase__	(self       :		Optional[int] ,   _UpperCAmelCase       :		int						)		->  int:




												"""simple docstring"""


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


										def     lowerCamelCase__	(self       :		Dict ,   _UpperCAmelCase       :		List[Any] ,   _UpperCAmelCase       :		Optional[Any]						)		->  Optional[Any]:




												"""simple docstring"""


												lowercase__	     =						self.find(lowerCAmelCase__						)
												lowercase__	     =						self.find(lowerCAmelCase__						)

												if roota == roota:
														return roota

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

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

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






					@staticmethod
					def     lowerCamelCase__	(_UpperCAmelCase       :		List[str]						)		->  List[str]:




							"""simple docstring"""


							lowercase__	     =						graph.num_vertices

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

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

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



def  __snake_case							(	__magic_name__						):







				'''simple docstring'''


				lowercase     ,	lowercase         =      [], []
				while len(__magic_name__						) > 1:
								lowercase     ,	lowercase         =      min(__magic_name__						), max(__magic_name__						)
								start.append(__magic_name__						)
								end.append(__magic_name__						)
								collection.remove(__magic_name__						)
								collection.remove(__magic_name__						)
				end.reverse()
				return start + collection + end


if __name__ == "__main__":
						_snake_case      :							int     	=    input("Enter numbers separated by a comma:\n").strip()
						_snake_case      :							Dict     	=    [int(item) for item in user_input.split(",")]
						print(*merge_sort(unsorted), sep=",")
