




from __future__ import annotations

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




@total_ordering
class 					snake_case__							(_UpperCamelCase     ):
				"""simple docstring"""



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





				def __eq__(   self       :  int      ,   __lowerCamelCase       :  Optional[Any]							)      ->  str:
							return self[-1] == other[-1]




def     __magic_name__       (				A	:      list     ):






			'''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__":
		__lowerCAmelCase	:       int     =   input('Enter numbers separated by a comma:\n').strip()
		__lowerCAmelCase	:       str     =   [int(item) for item in user_input.split(',')]
		print(patience_sort(unsorted))












from typing import TYPE_CHECKING

from ....utils import _LazyModule


__lowerCAmelCase	:       int     =	{'tokenization_tapex': ['TapexTokenizer']}


if TYPE_CHECKING:
		from .tokenization_tapex import TapexTokenizer


else:
		import sys

		__lowerCAmelCase	:       Tuple     =	_LazyModule(__name__, globals()['__file__'], _import_structure)






