


"""simple docstring"""



from __future__ import annotations

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







@total_ordering
class _lowerCAmelCase       (   lowercase_			):







   def __lt__(			self		,			UpperCamelCase__		)			->	List[Any]:

       '''simple docstring'''




       return self[-1] < other[-1]







   def __eq__(			self		,			UpperCamelCase__		)			->	int:

       '''simple docstring'''




       return self[-1] == other[-1]







def 						__lowerCAmelCase		(		lowercase						:						Tuple				)			->		Tuple:


    """simple docstring"""





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

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


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









"""simple docstring"""



import baseaa







def 						__lowerCAmelCase		(		lowercase						:						str				)			->		bytes:


    """simple docstring"""





    return baseaa.aaaencode(string.encode("utf-8"				)				)







def 						__lowerCAmelCase		(		lowercase						:						bytes				)			->		str:


    """simple docstring"""





    return baseaa.aaadecode(lowercase				).decode("utf-8"				)


if __name__ == "__main__":
  import doctest

  doctest.testmod()





