


"""simple docstring"""







import operator




def      UpperCAmelCase__ (lowerCAmelCase_						,		lowerCAmelCase_ = False						,		lowerCAmelCase_ = None     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       operator.lt if reverse else operator.gt
					__SCREAMING_SNAKE_CASE		     =       solution or []

					if not arr:
										return solution

					__SCREAMING_SNAKE_CASE		     =       [arr.pop(0     )]
					for i, item in enumerate(lowerCAmelCase_     ):
										if _operator(lowerCAmelCase_						,		sublist[-1]     ):
															sublist.append(lowerCAmelCase_     )
															arr.pop(lowerCAmelCase_     )

    #  merging sublist into solution list
					if not solution:
										solution.extend(lowerCAmelCase_     )
					else:
										while sublist:
															__SCREAMING_SNAKE_CASE		     =       sublist.pop(0     )
															for i, xx in enumerate(lowerCAmelCase_     ):
																				if not _operator(lowerCAmelCase_						,		lowerCAmelCase_     ):
																									solution.insert(lowerCAmelCase_						,		lowerCAmelCase_     )
																									break
															else:
																				solution.append(lowerCAmelCase_     )

					strand_sort(lowerCAmelCase_						,		lowerCAmelCase_						,		lowerCAmelCase_     )
					return solution


if __name__ == "__main__":
		assert strand_sort([4, 3, 5, 1, 2]) == [1, 2, 3, 4, 5]
		assert strand_sort([4, 3, 5, 1, 2], reverse=True) == [5, 4, 3, 2, 1]




"""simple docstring"""







from abc import ABC, abstractmethod
from argparse import ArgumentParser




class 				UpperCamelCase_			(				UpperCamelCase):

	"""simple docstring"""





	@staticmethod
	@abstractmethod
	def 						UpperCAmelCase_   (				UpperCAmelCase__    :       ArgumentParser     ) ->			Optional[Any]:
						raise NotImplementedError()




	@abstractmethod
	def 						UpperCAmelCase_   (				self    :       Optional[Any]     ) ->			List[str]:
						raise NotImplementedError()
