




'''simple docstring'''



from __future__ import annotations




def   lowercase__(			__UpperCamelCase:					list[int]    ):  # This function is recursive

      """simple docstring"""






      SCREAMING_SNAKE_CASE   :      Optional[int]    					=						len(__UpperCamelCase    )
      # If the array contains only one element, we return it (it's the stop condition of
      # recursion)
      if array_length <= 1:
            return array
            # Else
      SCREAMING_SNAKE_CASE   :      Optional[Any]    					=						array[0]
      SCREAMING_SNAKE_CASE   :      List[str]    					=						False
      SCREAMING_SNAKE_CASE   :      Any    					=						1
      SCREAMING_SNAKE_CASE   :      list[int]    					=						[]
      while not is_found and i < array_length:
            if array[i] < pivot:
                  SCREAMING_SNAKE_CASE   :      int    					=						True
                  SCREAMING_SNAKE_CASE   :      Optional[int]    					=						[element for element in array[i:] if element >= array[i]]
                  SCREAMING_SNAKE_CASE   :      List[str]    					=						longest_subsequence(__UpperCamelCase    )
                  if len(__UpperCamelCase    ) > len(__UpperCamelCase    ):
                        SCREAMING_SNAKE_CASE   :      List[str]    					=						temp_array
            else:
                  i += 1

      SCREAMING_SNAKE_CASE   :      Tuple    					=						[element for element in array[1:] if element >= pivot]
      SCREAMING_SNAKE_CASE   :      Optional[Any]    					=						[pivot, *longest_subsequence(__UpperCamelCase    )]
      if len(__UpperCamelCase    ) > len(__UpperCamelCase    ):
            return temp_array
      else:
            return longest_subseq


if __name__ == "__main__":
      import doctest

      doctest.testmod()







'''simple docstring'''

from __future__ import annotations

from bisect import bisect_left
from functools import total_ordering
from heapq import merge






@total_ordering
class 						a_		(     snake_case    ):


							def __lt__(				self   :						List[Any]      ,						a_   :						Optional[int]			)			->					List[str]:
										return self[-1] < other[-1]




							def __eq__(				self   :						int      ,						a_   :						Union[str, Any]			)			->					List[str]:
										return self[-1] == other[-1]







def a_     (    __UpperCAmelCase					)				->					list:





			"""simple docstring"""







			snake_case:    list[Stack]      							=[]
			# sort into stacks
			for element in collection:
						snake_case:    int      							=Stack([element]					)
						snake_case:    Union[str, Any]      							=bisect_left(__UpperCAmelCase				,							__UpperCAmelCase					)
						if i != len(__UpperCAmelCase					):
									stacks[i].append(__UpperCAmelCase					)
						else:
									stacks.append(__UpperCAmelCase					)

    # use a heap-based merge to merge stack efficiently
			snake_case:    int      							=merge(*(reversed(__UpperCAmelCase					) for stack in stacks)					)
			return collection


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




