
import heapq as hq
import math
from collections.abc import Iterator







class   lowerCamelCase	:





      def __init__(self   :					str       ,					_A   :					Union[str, Any]     )		->		int:
          snake_case				  =      str(id_     )
          snake_case				  =      None
          snake_case				  =      None
          snake_case				  =      []
          snake_case				  =      {}  # {vertex:distance}





      def __lt__(self   :					Any       ,					_A   :					Optional[Any]     )		->		str:
          return self.key < other.key





      def __repr__(self   :					int     )		->		List[str]:
          return self.id





      def 	UpperCAmelCase(self   :					Union[str, Any]       ,					_A   :					Union[str, Any]     )		->		Optional[Any]:
          self.neighbors.append(A_     )





      def 	UpperCAmelCase(self   :					int       ,					_A   :					Optional[Any]       ,					_A   :					Optional[Any]     )		->		Optional[int]:
          snake_case				  =      weight



def 		lowercase_    (     A__				,	A__				,	A__				,	A__	)							->							List[Any]:
    """simple docstring"""

    graph[a - 1].add_neighbor(graph[b - 1]	)
    graph[b - 1].add_neighbor(graph[a - 1]	)
    # add the edges:
    graph[a - 1].add_edge(graph[b - 1]				,	_lowerCAmelCase	)
    graph[b - 1].add_edge(graph[a - 1]				,	_lowerCAmelCase	)



def 		lowercase_    (     A__				,	A__	)							->							list:
    """simple docstring"""

    snake_case				  =      []
    for u in graph:
        snake_case				  =      math.inf
        snake_case				  =      None
    snake_case				  =      0
    snake_case				  =      graph[:]
    while q:
        snake_case				  =      min(_lowerCAmelCase	)
        q.remove(_lowerCAmelCase	)
        for v in u.neighbors:
            if (v in q) and (u.edges[v.id] < v.key):
                snake_case				  =      u
                snake_case				  =      u.edges[v.id]
    for i in range(1				,	len(_lowerCAmelCase	)	):
        a.append((int(graph[i].id	) + 1, int(graph[i].pi.id	) + 1)	)
    return a



def 		lowercase_    (     A__				,	A__	)							->							Iterator[tuple]:
    """simple docstring"""

    for u in graph:
        snake_case				  =      math.inf
        snake_case				  =      None
    snake_case				  =      0

    snake_case				  =      list(_lowerCAmelCase	)
    hq.heapify(_lowerCAmelCase	)

    while h:
        snake_case				  =      hq.heappop(_lowerCAmelCase	)
        for v in u.neighbors:
            if (v in h) and (u.edges[v.id] < v.key):
                snake_case				  =      u
                snake_case				  =      u.edges[v.id]
                hq.heapify(_lowerCAmelCase	)

    for i in range(1				,	len(_lowerCAmelCase	)	):
        yield (int(graph[i].id	) + 1, int(graph[i].pi.id	) + 1)



def 		lowercase_    (     )							->							None:
    """simple docstring"""

    pass


if __name__ == "__main__":
   import doctest

   doctest.testmod()



_A						      =				0  # The first color of the flag.
_A						      =				1  # The second color of the flag.
_A						      =				2  # The third color of the flag.
_A						      =				(red, white, blue)



def 		lowercase_    (     A__	)							->							list:
    """simple docstring"""

    if not sequence:
        return []
    if len(A__	) == 1:
        return list(A__	)
    snake_case				  =      0
    snake_case				  =      len(A__	) - 1
    snake_case				  =      0
    while mid <= high:
        if sequence[mid] == colors[0]:
            snake_case  ,							snake_case				  =      sequence[mid], sequence[low]
            low += 1
            mid += 1
        elif sequence[mid] == colors[1]:
            mid += 1
        elif sequence[mid] == colors[2]:
            snake_case  ,							snake_case				  =      sequence[high], sequence[mid]
            high -= 1
        else:
            snake_case				  =      F'The elements inside the sequence must contains only {colors} values'
            raise ValueError(A__	)
    return sequence


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   _A						      =				input("Enter numbers separated by commas:\n").strip()
   _A						      =				[int(item.strip()) for item in user_input.split(",")]
   print(f"{dutch_national_flag_sort(unsorted)}")

