





import random


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase		,			_UpperCAmelCase				)    ->  List[Any]:
    lowerCamelCase__					:   List[Any]      				=	a[left_index]
    lowerCamelCase__					:   Tuple      				=	left_index + 1
    for j in range(left_index + 1		,			_UpperCAmelCase				):
        if a[j] < pivot:
            lowerCamelCase__				,							lowerCamelCase__					:   Optional[int]      				=	a[i], a[j]
            i += 1
    lowerCamelCase__				,							lowerCamelCase__					:   Tuple      				=	a[i - 1], a[left_index]
    return i - 1


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase		,			_UpperCAmelCase				)    ->  List[Any]:
    if left < right:
        lowerCamelCase__					:   Dict      				=	random.randint(_UpperCAmelCase		,			right - 1				)
        lowerCamelCase__				,							lowerCamelCase__					:   Tuple      				=	(
            a[left],
            a[pivot],
        )  # switches the pivot with the left most bound
        lowerCamelCase__					:   Union[str, Any]      				=	partition(_UpperCAmelCase		,			_UpperCAmelCase		,			_UpperCAmelCase				)
        quick_sort_random(
            _UpperCAmelCase		,			_UpperCAmelCase		,			_UpperCAmelCase				)  # recursive quicksort to the left of the pivot point
        quick_sort_random(
            _UpperCAmelCase		,			pivot_index + 1		,			_UpperCAmelCase				)  # recursive quicksort to the right of the pivot point


def  SCREAMING_SNAKE_CASE   ( )    ->  List[Any]:
    lowerCamelCase__					:   int      				=	input('Enter numbers separated by a comma:\n'				).strip()
    lowerCamelCase__					:   Union[str, Any]      				=	[int(_UpperCAmelCase				) for item in user_input.split(','				)]

    quick_sort_random(_UpperCAmelCase		,			0		,			len(_UpperCAmelCase				)				)

    print(_UpperCAmelCase				)


if __name__ == "__main__":
    main()












from __future__ import annotations

from collections.abc import Iterable, Iterator
from dataclasses import dataclass

_UpperCAmelCase       : Union[str, Any]			     =       (3, 9, -11, 0, 7, 5, 1, -1)
_UpperCAmelCase       : Union[str, Any]			     =       (4, 6, 2, 0, 8, 10, 3, -2)

@dataclass
class      lowerCAmelCase							:
 UpperCAmelCase__									=	42
 UpperCAmelCase__									=	42


class      lowerCAmelCase							:
 def __init__(   self						:   Any    ,  UpperCAmelCase						:   Iterable[int]			)    ->			None:
     lowerCamelCase__					:   Node | None      				=	None
     for i in sorted(UpperCAmelCase    ,  reverse=UpperCAmelCase			):
         lowerCamelCase__					:   Tuple      				=	Node(UpperCAmelCase    ,  self.head			)
 def __iter__(   self						:   Optional[int]			)    ->			Iterator[int]:
     lowerCamelCase__					:   str      				=	self.head
     while node:
         yield node.data
         lowerCamelCase__					:   List[str]      				=	node.next_node
 def __len__(   self						:   List[str]			)    ->			int:
     return sum(1 for _ in self			)







 def __str__(   self						:   Any			)    ->			str:
     return " -> ".join([str(UpperCAmelCase			) for node in self]			)


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase				)    ->  SortedLinkedList:
    return SortedLinkedList(list(_UpperCAmelCase				) + list(_UpperCAmelCase				)				)


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    _UpperCAmelCase       : Optional[Any]			     =       SortedLinkedList
    print(merge_lists(SSL(test_data_odd), SSL(test_data_even)))





