



def __lowerCAmelCase			(  SCREAMING_SNAKE_CASE_    ,	SCREAMING_SNAKE_CASE_	):
			lowercase__       	=					[1]
			for i in range(2    ,	SCREAMING_SNAKE_CASE_	):
						factorials.append(factorials[-1] * i	)
			assert 0 <= k < factorials[-1] * n, "k out of bounds"

			lowercase__       	=					[]
			lowercase__       	=					list(range(SCREAMING_SNAKE_CASE_	)	)

			# Find permutation
			while factorials:
						lowercase__       	=					factorials.pop()
						lowercase__	,							lowercase__       	=					divmod(SCREAMING_SNAKE_CASE_    ,	SCREAMING_SNAKE_CASE_	)
						permutation.append(elements[number]	)
						elements.remove(elements[number]	)
			permutation.append(elements[0]	)

			return permutation


if __name__ == "__main__":
							import doctest

							doctest.testmod()







'''simple docstring'''




def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : list[int]							, SCREAMING_SNAKE_CASE   : list[int]							, SCREAMING_SNAKE_CASE   : int    ):
  return not any(
      neighbour == 1 and colored_vertices[i] == color
      for i, neighbour in enumerate(SCREAMING_SNAKE_CASE    )    )


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : list[list[int]]							, SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : list[int]							, SCREAMING_SNAKE_CASE   : int    ):

  # Base Case
  if index == len(SCREAMING_SNAKE_CASE    ):
    return True

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



def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : list[list[int]]							, SCREAMING_SNAKE_CASE   : int    ):
  UpperCAmelCase    				=						[-1] * len(SCREAMING_SNAKE_CASE    )

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

  return []


