'''simple docstring'''

from collections.abc import Iterable
from typing import Generic, TypeVar

UpperCamelCase__  :						str					=      TypeVar('_T')


class 					_lowercase						(   Generic[_T] ):
      '''simple docstring'''


      def __init__(					self       ,lowerCamelCase_ = None				)      ->      None:



         '''simple docstring'''



         UpperCAmelCase__				:					list[_T] 					=	list(iterable or []				)
         UpperCAmelCase__				:					list[_T] 					=	[]




      def __len__(					self				)      ->      int:



         '''simple docstring'''



         return len(self._stacka				) + len(self._stacka				)




      def __repr__(					self				)      ->      str:



         '''simple docstring'''



         return f'''Queue({tuple(self._stacka[::-1] + self._stacka				)})'''




      def 		lowerCAmelCase__       (					self       ,lowerCamelCase_				)      ->      None:



         '''simple docstring'''



         self._stacka.append(lowerCamelCase_				)




      def 		lowerCAmelCase__       (					self				)      ->      _T:



         '''simple docstring'''



         UpperCAmelCase__				:					Optional[int] 					=	self._stacka.pop
         UpperCAmelCase__				:					Optional[int] 					=	self._stacka.append

         if not self._stacka:
            while self._stacka:
               stacka_append(stacka_pop()				)

         if not self._stacka:
            raise IndexError('''Queue is empty'''				)
         return self._stacka.pop()


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

  testmod()





'''simple docstring'''

from __future__ import annotations







def __UpperCamelCase( _A       :					list[int]	,      _A       :					int	,      _A       :					int	,      _A       :					int     ):
   '''simple docstring'''
   if (direction == 1 and array[indexa] > array[indexa]) or (
       direction == 0 and array[indexa] < array[indexa]
   ):
      UpperCAmelCase__					,   UpperCAmelCase__				:					Union[str, Any] 					=	array[indexa], array[indexa]







def __UpperCamelCase( _A       :					list[int]	,      _A       :					int	,      _A       :					int	,      _A       :					int     ):
   '''simple docstring'''
   if length > 1:
      UpperCAmelCase__				:					List[Any] 					=	int(length / 2     )
      for i in range(_A	,      low + middle     ):
         comp_and_swap(_A	,      _A	,      i + middle	,      _A     )
      bitonic_merge(_A	,      _A	,      _A	,      _A     )
      bitonic_merge(_A	,      low + middle	,      _A	,      _A     )







def __UpperCamelCase( _A       :					list[int]	,      _A       :					int	,      _A       :					int	,      _A       :					int     ):
   '''simple docstring'''
   if length > 1:
      UpperCAmelCase__				:					Optional[int] 					=	int(length / 2     )
      bitonic_sort(_A	,      _A	,      _A	,      1     )
      bitonic_sort(_A	,      low + middle	,      _A	,      0     )
      bitonic_merge(_A	,      _A	,      _A	,      _A     )


if __name__ == "__main__":
  UpperCamelCase__  :						Dict					=      input('Enter numbers separated by a comma:\n').strip()
  UpperCamelCase__  :						Tuple					=      [int(item.strip()) for item in user_input.split(',')]

  bitonic_sort(unsorted, 0, len(unsorted), 1)
  print('\nSorted array in ascending order is: ', end='')
  print(*unsorted, sep=', ')

  bitonic_merge(unsorted, 0, len(unsorted), 0)
  print('Sorted array in descending order is: ', end='')
  print(*unsorted, sep=', ')




