


"""simple docstring"""







import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig


__lowercase          = logging.get_logger(__name__)

__lowercase          = {
    """facebook/musicgen-small""": """https://huggingface.co/facebook/musicgen-small/resolve/main/config.json""",
    # See all Musicgen models at https://huggingface.co/models?filter=musicgen
}






class 		_A    (    _a    ):







    """simple docstring"""




    UpperCAmelCase			:				int      =			"""musicgen_decoder"""
    UpperCAmelCase			:				str      =			["""past_key_values"""]






    def __init__(   self							:       Tuple							,					__UpperCAmelCase							:       Any=2048							,					__UpperCAmelCase							:       Optional[int]=2048							,					__UpperCAmelCase							:       List[str]=24							,					__UpperCAmelCase							:       Optional[int]=4096							,					__UpperCAmelCase							:       List[str]=16							,					__UpperCAmelCase							:       List[str]=0.0							,					__UpperCAmelCase							:       Optional[Any]=True							,					__UpperCAmelCase							:       List[str]="gelu"							,					__UpperCAmelCase							:       Union[str, Any]=1024							,					__UpperCAmelCase							:       Optional[Any]=0.1							,					__UpperCAmelCase							:       Union[str, Any]=0.0							,					__UpperCAmelCase							:       Optional[int]=0.0							,					__UpperCAmelCase							:       Optional[int]=0.02							,					__UpperCAmelCase							:       Optional[int]=False							,					__UpperCAmelCase							:       Optional[int]=4							,					__UpperCAmelCase							:       Optional[int]=2048							,					__UpperCAmelCase							:       List[str]=2048							,					__UpperCAmelCase							:       Union[str, Any]=None							,					__UpperCAmelCase							:       int=False							,					**__UpperCAmelCase							:       Optional[Any]							,					):
      a		:						Dict 				=     vocab_size
      a		:						Tuple 				=     max_position_embeddings
      a		:						List[str] 				=     hidden_size
      a		:						Dict 				=     ffn_dim
      a		:						Optional[int] 				=     num_hidden_layers
      a		:						Tuple 				=     num_attention_heads
      a		:						List[str] 				=     dropout
      a		:						List[Any] 				=     attention_dropout
      a		:						Union[str, Any] 				=     activation_dropout
      a		:						Dict 				=     activation_function
      a		:						Union[str, Any] 				=     initializer_factor
      a		:						Union[str, Any] 				=     layerdrop
      a		:						Optional[int] 				=     use_cache
      a		:						Optional[int] 				=     scale_embedding  # scale factor will be sqrt(d_model) if True
      a		:						Dict 				=     num_codebooks
      super().__init__(
          pad_token_id=__UpperCAmelCase							,					bos_token_id=__UpperCAmelCase							,					eos_token_id=__UpperCAmelCase							,					tie_word_embeddings=__UpperCAmelCase							,					**__UpperCAmelCase							,					)






class 		_A    (    _a    ):







    """simple docstring"""




    UpperCAmelCase			:				Optional[Any]      =			"""musicgen"""
    UpperCAmelCase			:				Optional[int]      =			True






    def __init__(   self							:       Any							,					**__UpperCAmelCase							:       Dict):
      super().__init__(**__UpperCAmelCase)
      if "text_encoder" not in kwargs or "audio_encoder" not in kwargs or "decoder" not in kwargs:
        raise ValueError("Config has to be initialized with text_encoder, audio_encoder and decoder config")

      a		:						List[Any] 				=     kwargs.pop("text_encoder")
      a		:						Optional[int] 				=     text_encoder_config.pop("model_type")

      a		:						int 				=     kwargs.pop("audio_encoder")
      a		:						Tuple 				=     audio_encoder_config.pop("model_type")

      a		:						Union[str, Any] 				=     kwargs.pop("decoder")

      a		:						str 				=     AutoConfig.for_model(__UpperCAmelCase							,					**__UpperCAmelCase)
      a		:						int 				=     AutoConfig.for_model(__UpperCAmelCase							,					**__UpperCAmelCase)
      a		:						Optional[Any] 				=     MusicgenDecoderConfig(**__UpperCAmelCase)
      a		:						List[str] 				=     True






    @classmethod
    def       __snake_case				(   cls							:       Dict							,					__UpperCAmelCase							:       PretrainedConfig							,					__UpperCAmelCase							:       PretrainedConfig							,					__UpperCAmelCase							:       MusicgenDecoderConfig							,					**__UpperCAmelCase							:       str							,					):
      return cls(
          text_encoder=text_encoder_config.to_dict()							,					audio_encoder=audio_encoder_config.to_dict()							,					decoder=decoder_config.to_dict()							,					**__UpperCAmelCase							,					)






    def       __snake_case				(   self							:       Union[str, Any]):
      a		:						int 				=     copy.deepcopy(self.__dict__)
      a		:						List[Any] 				=     self.text_encoder.to_dict()
      a		:						Any 				=     self.audio_encoder.to_dict()
      a		:						Optional[int] 				=     self.decoder.to_dict()
      a		:						Optional[int] 				=     self.__class__.model_type
      return output










"""simple docstring"""







def 	lowercase     (							A_    ,  A_			)-> list[tuple[int, int, int]]:
  '''simple docstring'''







  a		:						Union[str, Any] 				=     sorted(A_    ,  key=lambda A_			: edge[2]			)

  a		:						List[Any] 				=     list(range(A_			)			)

  def find_parent(A_			):
    if i != parent[i]:
      a		:						Dict 				=     find_parent(parent[i]			)
    return parent[i]

  a		:						Optional[Any] 				=     0
  a		:						Optional[int] 				=     []

  for edge in edges:
    a		:						List[str] 				=     find_parent(edge[0]			)
    a		:						int 				=     find_parent(edge[1]			)
    if parent_a != parent_b:
      minimum_spanning_tree_cost += edge[2]
      minimum_spanning_tree.append(A_			)
      a		:						Tuple 				=     parent_b

  return minimum_spanning_tree


if __name__ == "__main__":  # pragma: no cover
 __lowercase   ,				__lowercase          = list(map(int, input().strip().split()))
 __lowercase          = []

 for _ in range(num_edges):
  __lowercase   ,				__lowercase   ,				__lowercase          = (int(x) for x in input().strip().split())
  edges.append((nodea, nodea, cost))

 kruskal(num_nodes, edges)






