
'''simple docstring'''







import os
import sys
from contextlib import contextmanager


# Windows only
if os.name == "nt":
					import ctypes
					import msvcrt  # noqa


					class 						__UpperCAmelCase      (					ctypes.Structure						):
												# _fields is a specific attr expected by ctypes
												__lowercase      		=       [("""size""", ctypes.c_int), ("""visible""", ctypes.c_byte)]







def 				SCREAMING_SNAKE_CASE__	(   )       ->	List[Any]:
	if os.name == "nt":
		_snake_case   						=		CursorInfo()
		_snake_case   						=		ctypes.windll.kernelaa.GetStdHandle(-11	)
		ctypes.windll.kernelaa.GetConsoleCursorInfo(__A			,				ctypes.byref(__A	)	)
		_snake_case   						=		False
		ctypes.windll.kernelaa.SetConsoleCursorInfo(__A			,				ctypes.byref(__A	)	)
	elif os.name == "posix":
		sys.stdout.write('\033[?25l'	)
		sys.stdout.flush()







def 				SCREAMING_SNAKE_CASE__	(   )       ->	List[str]:
	if os.name == "nt":
		_snake_case   						=		CursorInfo()
		_snake_case   						=		ctypes.windll.kernelaa.GetStdHandle(-11	)
		ctypes.windll.kernelaa.GetConsoleCursorInfo(__A			,				ctypes.byref(__A	)	)
		_snake_case   						=		True
		ctypes.windll.kernelaa.SetConsoleCursorInfo(__A			,				ctypes.byref(__A	)	)
	elif os.name == "posix":
		sys.stdout.write('\033[?25h'	)
		sys.stdout.flush()







@contextmanager
def 				SCREAMING_SNAKE_CASE__	(   )       ->	Union[str, Any]:
	try:
		hide_cursor()
		yield
	finally:
		show_cursor()



"""simple docstring"""



from __future__ import annotations

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

@total_ordering
class       lowerCAmelCase__				(						A_	):







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







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






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



