



from __future__ import annotations

from typing import Generic, TypeVar

lowercase_	       =			TypeVar('''T''')






class 						__a (     Generic[T]				):



	def __init__(						self							:    Union[str, Any]				,	snake_case_							:    T)->							None:
						__lowerCAmelCase	   =data
						__lowerCAmelCase	   =self
						__lowerCAmelCase	   =0






class 						__a (     Generic[T]				):



	def __init__(						self							:    Any)->							None:
						__lowerCAmelCase	   ={}



	def 		UpperCamelCase							(						self							:    Union[str, Any]				,	snake_case_							:    T)->							None:
						__lowerCAmelCase	   =DisjointSetTreeNode(lowerCamelCase__)



	def 		UpperCamelCase							(						self							:    int				,	snake_case_							:    T)->							DisjointSetTreeNode[T]:
						__lowerCAmelCase	   =self.map[data]
						if elem_ref != elem_ref.parent:
											__lowerCAmelCase	   =self.find_set(elem_ref.parent.data)
						return elem_ref.parent



	def 		UpperCamelCase							(						self							:    List[str]				,	snake_case_							:    DisjointSetTreeNode[T]				,	snake_case_							:    DisjointSetTreeNode[T])->							None:







						if nodea.rank > nodea.rank:
											__lowerCAmelCase	   =nodea
						else:
											__lowerCAmelCase	   =nodea
											if nodea.rank == nodea.rank:
																nodea.rank += 1



	def 		UpperCamelCase							(						self							:    Optional[Any]				,	snake_case_							:    T				,	snake_case_							:    T)->							None:
						self.link(self.find_set(lowerCamelCase__)				,	self.find_set(lowerCamelCase__))






class 						__a (     Generic[T]				):



	def __init__(						self							:    int)->							None:
						__lowerCAmelCase	   ={}



	def 		UpperCamelCase							(						self							:    Union[str, Any]				,	snake_case_							:    T)->							None:







						if node not in self.connections:
											__lowerCAmelCase	   ={}



	def 		UpperCamelCase							(						self							:    List[str]				,	snake_case_							:    T				,	snake_case_							:    T				,	snake_case_							:    int)->							None:
						self.add_node(lowerCamelCase__)
						self.add_node(lowerCamelCase__)
						__lowerCAmelCase	   =weight
						__lowerCAmelCase	   =weight



	def 		UpperCamelCase							(						self							:    List[Any])->							GraphUndirectedWeighted[T]:
						__lowerCAmelCase	   =[]
						__lowerCAmelCase	   =set()
						for start in self.connections:
											for end in self.connections[start]:
																if (start, end) not in seen:
																					seen.add((end, start))
																					edges.append((start, end, self.connections[start][end]))
						edges.sort(key=lambda snake_case_: x[2])

						# creating the disjoint set
						__lowerCAmelCase	   =DisjointSetTree[T]()
						for node in self.connections:
											disjoint_set.make_set(lowerCamelCase__)

						# MST generation
						__lowerCAmelCase	   =0
						__lowerCAmelCase	   =0
						__lowerCAmelCase	   =GraphUndirectedWeighted[T]()
						while num_edges < len(self.connections) - 1:
											__lowerCAmelCase	   =edges[index]
											index += 1
											__lowerCAmelCase	   =disjoint_set.find_set(lowerCamelCase__)
											__lowerCAmelCase	   =disjoint_set.find_set(lowerCamelCase__)
											if parent_u != parent_v:
																num_edges += 1
																graph.add_edge(lowerCamelCase__				,	lowerCamelCase__				,	lowerCamelCase__)
																disjoint_set.union(lowerCamelCase__				,	lowerCamelCase__)
						return graph









def 					__lowerCAmelCase		(  __lowerCamelCase	:    list	)  ->						list:
					__lowerCAmelCase	   =False
					while is_sorted is False:  # Until all the indices are traversed keep looping
										__lowerCAmelCase	   =True
										for i in range(0				,   len(__lowerCamelCase	) - 1				,   2	):  # iterating over all even indices
															if input_list[i] > input_list[i + 1]:
																				__lowerCAmelCase   ,	__lowerCAmelCase	   =input_list[i + 1], input_list[i]
																				# swapping if elements not in order
																				__lowerCAmelCase	   =False

										for i in range(1				,   len(__lowerCamelCase	) - 1				,   2	):  # iterating over all odd indices
															if input_list[i] > input_list[i + 1]:
																				__lowerCAmelCase   ,	__lowerCAmelCase	   =input_list[i + 1], input_list[i]
																				# swapping if elements not in order
																				__lowerCAmelCase	   =False
					return input_list


if __name__ == "__main__":
				print('''Enter list to be sorted''')
				lowercase_	       =			[int(x) for x in input().split()]
				# inputing elements of the list in one line
				lowercase_	       =			odd_even_sort(input_list)
				print('''The sorted list is''')
				print(sorted_list)




