





'''simple docstring'''


import math


def 						__a(SCREAMING_SNAKE_CASE_	:       int     ):



    '''simple docstring'''





    return math.sqrt(SCREAMING_SNAKE_CASE_     ) * math.sqrt(SCREAMING_SNAKE_CASE_     ) == num


def 						__a(SCREAMING_SNAKE_CASE_	:       int     ):



    '''simple docstring'''





    _lowerCAmelCase						      =   0
    _lowerCAmelCase						      =   n
    while left <= right:
        _lowerCAmelCase						      =   (left + right) // 2
        if mid**2 == n:
            return True
        elif mid**2 > n:
            _lowerCAmelCase						      =   mid - 1
        else:
            _lowerCAmelCase						      =   mid + 1
    return False


if __name__ == "__main__":
       import doctest

       doctest.testmod()







"""simple docstring"""




from __future__ import annotations

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






@total_ordering
class       UpperCAmelCase_    (							_UpperCamelCase		):



      def __lt__(	self	:      int	,      A	:      Dict		):
           return self[-1] < other[-1]



      def __eq__(	self	:      Union[str, Any]	,      A	:      Union[str, Any]		):
           return self[-1] == other[-1]







def 		__snake_case		( SCREAMING_SNAKE_CASE__      :		list							)    ->  list:





     '''simple docstring'''

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

    # use a heap-based merge to merge stack efficiently
     _UpperCAmelCase     :      Optional[Any]														=       merge(*(reversed(SCREAMING_SNAKE_CASE__							) for stack in stacks)							)
     return collection


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