
"""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   ):




			"""simple docstring"""







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







								"""simple docstring"""
								return self[-1] < other[-1]






			def __eq__(					self    :       Any							, _snake_case    :       int						)   ->			Tuple:







								"""simple docstring"""
								return self[-1] == other[-1]





def 				A_  (__a					):

					'''simple docstring'''





					A_								=    []
					# sort into stacks
					for element in collection:
										A_								=    Stack([element]					)
										A_								=    bisect_left(__a					, __a					)
										if i != len(__a					):
															stacks[i].append(__a					)
										else:
															stacks.append(__a					)

    # use a heap-based merge to merge stack efficiently
					A_								=    merge(*(reversed(__a					) for stack in stacks)					)
					return collection


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






"""simple docstring"""





from __future__ import annotations
def 				A_  (__a					, __a = None					, __a = None					):

					'''simple docstring'''





					if start is None:
										A_								=    0

					if end is None:
										A_								=    len(__a					) - 1

					if start >= end:
										return

					A_								=    (start + end) // 2

					slowsort(__a					, __a					, __a					)
					slowsort(__a					, mid + 1					, __a					)

					if sequence[end] < sequence[mid]:
										A_			,     A_								=    sequence[mid], sequence[end]

					slowsort(__a					, __a					, end - 1					)


if __name__ == "__main__":
		from doctest import testmod

		testmod()




