

"""simple docstring"""




import sys
from collections import defaultdict







class      __lowercase			:

  def __init__(  self		:			Optional[Any]    ):






   '''simple docstring'''
   UpperCAmelCase__					:  Optional[Any]					   =					[]

  def    __lowercase       (  self		:			Union[str, Any]					,A		:			List[Any]    ):






   '''simple docstring'''
   return self.node_position[vertex]

  def    __lowercase       (  self		:			Dict					,A		:			Optional[Any]					,A		:			Union[str, Any]    ):






   '''simple docstring'''
   UpperCAmelCase__					:  Dict					   =					pos

  def    __lowercase       (  self		:			str					,A		:			Dict					,A		:			str					,A		:			str					,A		:			List[str]    ):






   '''simple docstring'''
   if start > size // 2 - 1:
    return
   else:
    if 2 * start + 2 >= size:
     UpperCAmelCase__					:  Optional[Any]					   =					2 * start + 1
    else:
     if heap[2 * start + 1] < heap[2 * start + 2]:
      UpperCAmelCase__					:  List[str]					   =					2 * start + 1
     else:
      UpperCAmelCase__					:  List[str]					   =					2 * start + 2
    if heap[smallest_child] < heap[start]:
     UpperCAmelCase__					:  str					   =					heap[smallest_child], positions[smallest_child]
     UpperCAmelCase__					:  Any					   =					(
         heap[start],
         positions[start],
     )
     UpperCAmelCase__					:  Optional[int]					   =					temp, tempa

     UpperCAmelCase__					:  Union[str, Any]					   =					self.get_position(positions[smallest_child]    )
     self.set_position(
         positions[smallest_child]					,self.get_position(positions[start]    )    )
     self.set_position(positions[start]					,A    )

     self.top_to_bottom(A					,A					,A					,A    )

  def    __lowercase       (  self		:			Dict					,A		:			Dict					,A		:			List[Any]					,A		:			Any					,A		:			Optional[int]    ):






   '''simple docstring'''
   UpperCAmelCase__					:  Union[str, Any]					   =					position[index]

   while index != 0:
    UpperCAmelCase__					:  int					   =					int((index - 2) / 2    ) if index % 2 == 0 else int((index - 1) / 2    )

    if val < heap[parent]:
     UpperCAmelCase__					:  Tuple					   =					heap[parent]
     UpperCAmelCase__					:  List[str]					   =					position[parent]
     self.set_position(position[parent]					,A    )
    else:
     UpperCAmelCase__					:  str					   =					val
     UpperCAmelCase__					:  Tuple					   =					temp
     self.set_position(A					,A    )
     break
    UpperCAmelCase__					:  List[str]					   =					parent
   else:
    UpperCAmelCase__					:  Dict					   =					val
    UpperCAmelCase__					:  Union[str, Any]					   =					temp
    self.set_position(A					,0    )

  def    __lowercase       (  self		:			List[str]					,A		:			str					,A		:			Tuple    ):






   '''simple docstring'''
   UpperCAmelCase__					:  Optional[int]					   =					len(A    ) // 2 - 1
   for i in range(A					,-1					,-1    ):
    self.top_to_bottom(A					,A					,len(A    )					,A    )




  def    __lowercase       (  self		:			str					,A		:			Union[str, Any]					,A		:			List[str]    ):






   '''simple docstring'''
   UpperCAmelCase__					:  str					   =					positions[0]
   UpperCAmelCase__					:  int					   =					sys.maxsize
   self.top_to_bottom(A					,0					,len(A    )					,A    )
   return temp







def   lowerCAmelCase						(					__UpperCamelCase      ):
 '''simple docstring'''





 UpperCAmelCase__					:  List[Any]					   =					Heap()

 UpperCAmelCase__					:  Tuple					   =					[0] * len(__UpperCamelCase      )
 UpperCAmelCase__					:  Tuple					   =					[-1] * len(__UpperCamelCase      )  # Neighboring Tree Vertex of selected vertex
 # Minimum Distance of explored vertex with neighboring vertex of partial tree
 # formed in graph
 UpperCAmelCase__					:  List[Any]					   =					[]  # Heap of Distance of vertices from their neighboring vertex
 UpperCAmelCase__					:  Any					   =					[]

 for vertex in range(len(__UpperCamelCase      )      ):
  distance_tv.append(sys.maxsize      )
  positions.append(__UpperCamelCase      )
  heap.node_position.append(__UpperCamelCase      )

 UpperCAmelCase__					:  List[str]					   =					[]
 UpperCAmelCase__					:  Union[str, Any]					   =					1
 UpperCAmelCase__					:  Optional[Any]					   =					sys.maxsize
 for neighbor, distance in adjacency_list[0]:
  UpperCAmelCase__					:  List[str]					   =					0
  UpperCAmelCase__					:  Dict					   =					distance
 heap.heapify(__UpperCamelCase							,    __UpperCamelCase      )

 for _ in range(1							,    len(__UpperCamelCase      )      ):
  UpperCAmelCase__					:  int					   =					heap.delete_minimum(__UpperCamelCase							,    __UpperCamelCase      )
  if visited[vertex] == 0:
   tree_edges.append((nbr_tv[vertex], vertex)      )
   UpperCAmelCase__					:  Optional[Any]					   =					1
   for neighbor, distance in adjacency_list[vertex]:
    if (
        visited[neighbor] == 0
        and distance < distance_tv[heap.get_position(__UpperCamelCase      )]
    ):
     UpperCAmelCase__					:  Dict					   =					distance
     heap.bottom_to_top(
         __UpperCamelCase							,    heap.get_position(__UpperCamelCase      )							,    __UpperCamelCase							,    __UpperCamelCase      )
     UpperCAmelCase__					:  int					   =					vertex
 return tree_edges


if __name__ == "__main__":  # pragma: no cover
      # < --------- Prims Algorithm --------- >
      __UpperCAmelCase =				int(input('Enter number of edges: ').strip())
      __UpperCAmelCase =				defaultdict(list)
      for _ in range(edges_number):
            __UpperCAmelCase =				[int(x) for x in input().strip().split()]
            adjacency_list[edge[0]].append([edge[1], edge[2]])
            adjacency_list[edge[1]].append([edge[0], edge[2]])
      print(prisms_algorithm(adjacency_list))








"""simple docstring"""




from ...configuration_utils import PretrainedConfig
from ...utils import logging


__UpperCAmelCase =				logging.get_logger(__name__)

__UpperCAmelCase =				{
    'microsoft/markuplm-base': 'https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json',
    'microsoft/markuplm-large': 'https://huggingface.co/microsoft/markuplm-large/resolve/main/config.json',
}







class      __lowercase			(    __lowerCamelCase					):
  snake_case_				       =       """markuplm"""

  def __init__(  self		:			str					,A		:			List[Any]=30_522					,A		:			Tuple=768					,A		:			str=12					,A		:			int=12					,A		:			int=3_072					,A		:			Optional[int]="gelu"					,A		:			Optional[int]=0.1					,A		:			Optional[int]=0.1					,A		:			Any=512					,A		:			Any=2					,A		:			str=0.0_2					,A		:			int=1e-12					,A		:			int=0					,A		:			str=0					,A		:			List[Any]=2					,A		:			List[str]=256					,A		:			Union[str, Any]=1_024					,A		:			List[Any]=216					,A		:			Any=1_001					,A		:			Optional[int]=32					,A		:			Any=50					,A		:			int="absolute"					,A		:			Dict=True					,A		:			int=None					,**A		:			Optional[int]					,):






   '''simple docstring'''
   super().__init__(
       pad_token_id=A					,bos_token_id=A					,eos_token_id=A					,**A					,)
   UpperCAmelCase__					:  Dict					   =					vocab_size
   UpperCAmelCase__					:  Union[str, Any]					   =					hidden_size
   UpperCAmelCase__					:  Optional[int]					   =					num_hidden_layers
   UpperCAmelCase__					:  Tuple					   =					num_attention_heads
   UpperCAmelCase__					:  Optional[Any]					   =					hidden_act
   UpperCAmelCase__					:  Any					   =					intermediate_size
   UpperCAmelCase__					:  Dict					   =					hidden_dropout_prob
   UpperCAmelCase__					:  Optional[Any]					   =					attention_probs_dropout_prob
   UpperCAmelCase__					:  Optional[int]					   =					max_position_embeddings
   UpperCAmelCase__					:  Dict					   =					type_vocab_size
   UpperCAmelCase__					:  Optional[Any]					   =					initializer_range
   UpperCAmelCase__					:  str					   =					layer_norm_eps
   UpperCAmelCase__					:  Any					   =					position_embedding_type
   UpperCAmelCase__					:  int					   =					use_cache
   UpperCAmelCase__					:  List[str]					   =					classifier_dropout
   # additional properties
   UpperCAmelCase__					:  Optional[int]					   =					max_depth
   UpperCAmelCase__					:  List[str]					   =					max_xpath_tag_unit_embeddings
   UpperCAmelCase__					:  Any					   =					max_xpath_subs_unit_embeddings
   UpperCAmelCase__					:  str					   =					tag_pad_id
   UpperCAmelCase__					:  Dict					   =					subs_pad_id
   UpperCAmelCase__					:  List[str]					   =					xpath_unit_hidden_size





