




'''simple docstring'''




class 		__A       :






       def __init__(      self				,     UpperCamelCase_      ):
              __UpperCAmelCase  :				Any       				=		set_counts
              __UpperCAmelCase  :				int       				=		max(UpperCamelCase_      )
              __UpperCAmelCase  :				List[str]       				=		len(UpperCamelCase_      )
              __UpperCAmelCase  :				Any       				=		[1] * num_sets
              __UpperCAmelCase  :				Any       				=		list(range(UpperCamelCase_      )      )






       def 			_snake_case						(      self				,     UpperCamelCase_				,     UpperCamelCase_      ):
              __UpperCAmelCase  :				Optional[int]       				=		self.get_parent(UpperCamelCase_      )
              __UpperCAmelCase  :				List[Any]       				=		self.get_parent(UpperCamelCase_      )

              if src_parent == dst_parent:
                     return False

              if self.ranks[dst_parent] >= self.ranks[src_parent]:
                     self.set_counts[dst_parent] += self.set_counts[src_parent]
                     __UpperCAmelCase  :				Optional[Any]       				=		0
                     __UpperCAmelCase  :				List[Any]       				=		dst_parent
                     if self.ranks[dst_parent] == self.ranks[src_parent]:
                            self.ranks[dst_parent] += 1
                     __UpperCAmelCase  :				Union[str, Any]       				=		self.set_counts[dst_parent]
              else:
                     self.set_counts[src_parent] += self.set_counts[dst_parent]
                     __UpperCAmelCase  :				Union[str, Any]       				=		0
                     __UpperCAmelCase  :				Dict       				=		src_parent
                     __UpperCAmelCase  :				Dict       				=		self.set_counts[src_parent]

              __UpperCAmelCase  :				Dict       				=		max(self.max_set				,     UpperCamelCase_      )
              return True







       def 			_snake_case						(      self				,     UpperCamelCase_      ):
              if self.parents[disj_set] == disj_set:
                     return disj_set
              __UpperCAmelCase  :				str       				=		self.get_parent(self.parents[disj_set]      )
              return self.parents[disj_set]







'''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 []






