'''simple docstring'''




def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__						)					->       int:





       """simple docstring"""


       while a != 0:
              __UpperCAmelCase				, __UpperCAmelCase  :				Optional[Any]       				=		b % a, a
       return b


def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__						)					->       int:





       """simple docstring"""


       if gcd(lowerCamelCase__							,    lowerCamelCase__						) != 1:
              __UpperCAmelCase  :				Any       				=		f"""mod inverse of {a!r} and {m!r} does not exist"""
              raise ValueError(lowerCamelCase__						)
       __UpperCAmelCase				, __UpperCAmelCase				, __UpperCAmelCase  :				str       				=		1, 0, a
       __UpperCAmelCase				, __UpperCAmelCase				, __UpperCAmelCase  :				Union[str, Any]       				=		0, 1, m
       while va != 0:
              __UpperCAmelCase  :				Any       				=		ua // va
              __UpperCAmelCase				, __UpperCAmelCase				, __UpperCAmelCase				, __UpperCAmelCase				, __UpperCAmelCase				, __UpperCAmelCase  :				List[Any]       				=		(ua - q * va), (ua - q * va), (ua - q * va), va, va, va
       return ua % m







'''simple docstring'''




def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__						)					->       bool:





       """simple docstring"""


       return not any(
           neighbour == 1 and colored_vertices[i] == color
           for i, neighbour in enumerate(lowerCamelCase__						)						)

def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__						)					->       bool:





       """simple docstring"""


       if index == len(lowerCamelCase__						):
              return True

       # Recursive Step
       for i in range(lowerCamelCase__						):
              if valid_coloring(graph[index]							,    lowerCamelCase__							,    lowerCamelCase__						):
                     # Color current vertex
                     __UpperCAmelCase  :				List[str]       				=		i
                     # Validate coloring
                     if util_color(lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__							,    index + 1						):
                            return True
                     # Backtrack
                     __UpperCAmelCase  :				Any       				=		-1
       return False


def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__						)					->       list[int]:





       """simple docstring"""


       __UpperCAmelCase  :				Optional[Any]       				=		[-1] * len(lowerCamelCase__						)

       if util_color(lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__							,    0						):
              return colored_vertices

       return []






