

import operator
def      a_ (      _A      ,   _A = False      ,   _A = None  )			->			str:







				"""simple docstring"""
				snake_case__									=     operator.lt if reverse else operator.gt
				snake_case__									=     solution or []

				if not arr:
								return solution

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

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

				strand_sort(_A      ,   _A      ,   _A  )
				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]












from __future__ import annotations
def      a_ (      _A  )			->			bool:







				"""simple docstring"""
				return len(set(_A  )  ) == len(_A  )


if __name__ == "__main__":
							import doctest

							doctest.testmod()




