'''simple docstring'''




import sys
from collections import defaultdict


class       UpperCAmelCase__  :
   def __init__(self				)    ->     List[str]:
        lowercase_					:       str     				=					[]
   def 		_lowerCamelCase (self       ,				_a				)    ->     str:
        return self.node_position[vertex]
   def 		_lowerCamelCase (self       ,				_a       ,				_a				)    ->     Union[str, Any]:
        lowercase_					:       Optional[Any]     				=					pos
   def 		_lowerCamelCase (self       ,				_a       ,				_a       ,				_a       ,				_a				)    ->     Dict:
        if start > size // 2 - 1:
             return
        else:
             if 2 * start + 2 >= size:
                  lowercase_					:       Optional[Any]     				=					2 * start + 1
             else:
                  if heap[2 * start + 1] < heap[2 * start + 2]:
                       lowercase_					:       Dict     				=					2 * start + 1
                  else:
                       lowercase_					:       Union[str, Any]     				=					2 * start + 2
             if heap[smallest_child] < heap[start]:
                  lowercase_					:       int     				=					heap[smallest_child], positions[smallest_child]
                  lowercase_					:       List[str]     				=					(
                      heap[start],
                      positions[start],
                  )
                  lowercase_					:       Optional[int]     				=					temp, tempa

                  lowercase_					:       Optional[int]     				=					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 		_lowerCamelCase (self       ,				_a       ,				_a       ,				_a       ,				_a				)    ->     int:
        lowercase_					:       Optional[int]     				=					position[index]

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

             if val < heap[parent]:
                  lowercase_					:       Union[str, Any]     				=					heap[parent]
                  lowercase_					:       Dict     				=					position[parent]
                  self.set_position(position[parent]       ,				_a				)
             else:
                  lowercase_					:       Union[str, Any]     				=					val
                  lowercase_					:       List[Any]     				=					temp
                  self.set_position(_a       ,				_a				)
                  break
             lowercase_					:       str     				=					parent
        else:
             lowercase_					:       Optional[Any]     				=					val
             lowercase_					:       Tuple     				=					temp
             self.set_position(_a       ,				0				)
   def 		_lowerCamelCase (self       ,				_a       ,				_a				)    ->     Optional[int]:
        lowercase_					:       Any     				=					len(_a				) // 2 - 1
        for i in range(_a       ,				-1       ,				-1				):
             self.top_to_bottom(_a       ,				_a       ,				len(_a				)       ,				_a				)





   def 		_lowerCamelCase (self       ,				_a       ,				_a				)    ->     Tuple:
        lowercase_					:       int     				=					positions[0]
        lowercase_					:       Dict     				=					sys.maxsize
        self.top_to_bottom(_a       ,				0       ,				len(_a				)       ,				_a				)
        return temp



def _UpperCamelCase   (       SCREAMING_SNAKE_CASE_							):
     lowercase_					:       Optional[int]     				=					Heap()

     lowercase_					:       str     				=					[0] * len(SCREAMING_SNAKE_CASE_							)
     lowercase_					:       Union[str, Any]     				=					[-1] * len(SCREAMING_SNAKE_CASE_							)  # Neighboring Tree Vertex of selected vertex
     # Minimum Distance of explored vertex with neighboring vertex of partial tree
     # formed in graph
     lowercase_					:       Any     				=					[]  # Heap of Distance of vertices from their neighboring vertex
     lowercase_					:       str     				=					[]

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

     lowercase_					:       Any     				=					[]
     lowercase_					:       int     				=					1
     lowercase_					:       Dict     				=					sys.maxsize
     for neighbor, distance in adjacency_list[0]:
          lowercase_					:       str     				=					0
          lowercase_					:       Union[str, Any]     				=					distance
     heap.heapify(SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							)

     for _ in range(1  ,       len(SCREAMING_SNAKE_CASE_							)							):
          lowercase_					:       Any     				=					heap.delete_minimum(SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							)
          if visited[vertex] == 0:
               tree_edges.append((nbr_tv[vertex], vertex)							)
               lowercase_					:       Union[str, Any]     				=					1
               for neighbor, distance in adjacency_list[vertex]:
                    if (
                        visited[neighbor] == 0
                        and distance < distance_tv[heap.get_position(SCREAMING_SNAKE_CASE_							)]
                    ):
                         lowercase_					:       List[str]     				=					distance
                         heap.bottom_to_top(
                             SCREAMING_SNAKE_CASE_  ,       heap.get_position(SCREAMING_SNAKE_CASE_							)  ,       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							)
                         lowercase_					:       int     				=					vertex
     return tree_edges


if __name__ == "__main__":  # pragma: no cover
 # < --------- Prims Algorithm --------- >
 _A								=   int(input('Enter number of edges: ').strip())
 _A								=   defaultdict(list)
 for _ in range(edges_number):
  _A								=   [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'''




import math
import os
import sys

def _UpperCamelCase   (       SCREAMING_SNAKE_CASE_							):
     lowercase_					:       List[str]     				=					''
     try:
          with open(SCREAMING_SNAKE_CASE_  ,       'rb'							) as binary_file:
               lowercase_					:       Dict     				=					binary_file.read()
          for dat in data:
               lowercase_					:       Union[str, Any]     				=					f'''{dat:08b}'''
               result += curr_byte
          return result
     except OSError:
          print('File not accessible'							)
          sys.exit()

def _UpperCamelCase   (       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							):
     lexicon.pop(SCREAMING_SNAKE_CASE_							)
     lowercase_					:       Any     				=					last_match_id

     if math.loga(SCREAMING_SNAKE_CASE_							).is_integer():
          for curr_key in lexicon:
               lowercase_					:       Tuple     				=					'0' + lexicon[curr_key]

     lowercase_					:       Any     				=					bin(SCREAMING_SNAKE_CASE_							)[2:]

def _UpperCamelCase   (       SCREAMING_SNAKE_CASE_							):
     lowercase_					:       Dict     				=					{'0': '0', '1': '1'}
     lowercase_				,lowercase_					:       Any     				=					'', ''
     lowercase_					:       List[Any]     				=					len(SCREAMING_SNAKE_CASE_							)

     for i in range(len(SCREAMING_SNAKE_CASE_							)							):
          curr_string += data_bits[i]
          if curr_string not in lexicon:
               continue

          lowercase_					:       str     				=					lexicon[curr_string]
          result += last_match_id
          add_key_to_lexicon(SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							)
          index += 1
          lowercase_					:       List[Any]     				=					''

     while curr_string != "" and curr_string not in lexicon:
          curr_string += "0"

     if curr_string != "":
          lowercase_					:       Optional[Any]     				=					lexicon[curr_string]
          result += last_match_id

     return result

def _UpperCamelCase   (       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							):
     lowercase_					:       List[str]     				=					os.path.getsize(SCREAMING_SNAKE_CASE_							)
     lowercase_					:       Any     				=					bin(SCREAMING_SNAKE_CASE_							)[2:]
     lowercase_					:       Optional[Any]     				=					len(SCREAMING_SNAKE_CASE_							)

     return "0" * (length_length - 1) + file_length_binary + compressed

def _UpperCamelCase   (       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							):
     lowercase_					:       List[str]     				=					8
     try:
          with open(SCREAMING_SNAKE_CASE_  ,       'wb'							) as opened_file:
               lowercase_					:       List[Any]     				=					[
                   to_write[i : i + byte_length]
                   for i in range(0  ,       len(SCREAMING_SNAKE_CASE_							)  ,       SCREAMING_SNAKE_CASE_							)
               ]

               if len(result_byte_array[-1]							) % byte_length == 0:
                    result_byte_array.append('10000000'							)
               else:
                    result_byte_array[-1] += "1" + "0" * (
                        byte_length - len(result_byte_array[-1]							) - 1
                    )

               for elem in result_byte_array:
                    opened_file.write(int(SCREAMING_SNAKE_CASE_  ,       2							).to_bytes(1  ,       byteorder='big'							)							)
     except OSError:
          print('File not accessible'							)
          sys.exit()

def _UpperCamelCase   (       SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							):
     lowercase_					:       List[str]     				=					read_file_binary(SCREAMING_SNAKE_CASE_							)
     lowercase_					:       List[str]     				=					compress_data(SCREAMING_SNAKE_CASE_							)
     lowercase_					:       Union[str, Any]     				=					add_file_length(SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							)
     write_file_binary(SCREAMING_SNAKE_CASE_  ,       SCREAMING_SNAKE_CASE_							)


if __name__ == "__main__":
 compress(sys.argv[1], sys.argv[2])




