


from __future__ import annotations

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






@total_ordering
class     UpperCamelCase(  _a   ):


					def __lt__(						self	:		List[Any]     ,    SCREAMING_SNAKE_CASE	:		Tuple						)			->	Dict:




											'''simple docstring'''

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






					def __eq__(						self	:		List[str]     ,    SCREAMING_SNAKE_CASE	:		int						)			->	Optional[int]:




											'''simple docstring'''

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





def 	_lowerCAmelCase       (    _lowerCAmelCase )						->	list:


						'''simple docstring'''






						__snake_case				=		[]
						# sort into stacks
						for element in collection:
												__snake_case				=		Stack([element] )
												__snake_case				=		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				=		merge(*(reversed(_lowerCAmelCase ) for stack in stacks) )
						return collection


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









import os
from typing import Dict, List, Tuple, TypeVar, Union


A							:					List[Any]     						=     TypeVar('T')

A							:					Dict     						=     Union[List[T], Tuple[T, ...]]
A							:					Any     						=     Union[T, List[T], Dict[str, T]]
A							:					Optional[int]     						=     Union[str, bytes, os.PathLike]





