"""simple docstring"""




class     UpperCamelCase__:





						def __init__(       self     )					->				None:
													A__	     =							{}  # Mapping from char to TrieNode
													A__	     =							False





						def 				snake_case__	(       self		,__UpperCAmelCase     )					->				None:
													for word in words:
																				self.insert(__UpperCAmelCase     )





						def 				snake_case__	(       self		,__UpperCAmelCase     )					->				None:
													A__	     =							self
													for char in word:
																				if char not in curr.nodes:
																											A__	     =							TrieNode()
																				A__	     =							curr.nodes[char]
													A__	     =							True





						def 				snake_case__	(       self		,__UpperCAmelCase     )					->				bool:
													A__	     =							self
													for char in word:
																				if char not in curr.nodes:
																											return False
																				A__	     =							curr.nodes[char]
													return curr.is_leaf





						def 				snake_case__	(       self		,__UpperCAmelCase     )					->				None:

													def _delete(__UpperCAmelCase		,__UpperCAmelCase		,__UpperCAmelCase     ) -> bool:
																				if index == len(__UpperCAmelCase     ):
																											# If word does not exist
																											if not curr.is_leaf:
																																		return False
																											A__	     =							False
																											return len(curr.nodes     ) == 0
																				A__	     =							word[index]
																				A__	     =							curr.nodes.get(__UpperCAmelCase     )
																				# If char not in current trie node
																				if not char_node:
																											return False
																				# Flag to check if node can be deleted
																				A__	     =							_delete(__UpperCAmelCase		,__UpperCAmelCase		,index + 1     )
																				if delete_curr:
																											del curr.nodes[char]
																											return len(curr.nodes     ) == 0
																				return delete_curr

													_delete(self		,__UpperCAmelCase		,0     )






def   UpperCAmelCase					(	UpperCamelCase__       ,    UpperCamelCase__				):






							"""simple docstring"""





							if node.is_leaf:
														print(UpperCamelCase__       ,    end=' '				)

							for key, value in node.nodes.items():
														print_words(UpperCamelCase__       ,    word + key				)






def   UpperCAmelCase					(	):






							"""simple docstring"""





							A__	     =							'banana bananas bandana band apple all beast'.split()
							A__	     =							TrieNode()
							root.insert_many(UpperCamelCase__				)
							# print_words(root, "")
							assert all(root.find(UpperCamelCase__				) for word in words				)
							assert root.find('banana'				)
							assert not root.find('bandanas'				)
							assert not root.find('apps'				)
							assert root.find('apple'				)
							assert root.find('all'				)
							root.delete('all'				)
							assert not root.find('all'				)
							root.delete('banana'				)
							assert not root.find('banana'				)
							assert root.find('bananas'				)
							return True






def   UpperCAmelCase					(	UpperCamelCase__       ,    UpperCamelCase__				):






							"""simple docstring"""





							print(str(UpperCamelCase__				)       ,    'works!' if passes else 'doesn\'t work :('				)






def   UpperCAmelCase					(	):






							"""simple docstring"""





							assert test_trie()






def   UpperCAmelCase					(	):






							"""simple docstring"""





							print_results('Testing trie functionality'       ,    test_trie()				)


if __name__ == "__main__":
				main()






"""simple docstring"""




def   UpperCAmelCase					(	UpperCamelCase__				):






							"""simple docstring"""





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


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





