'''simple docstring'''





import os
import sys
import time

from . import transposition_cipher as trans_cipher





def   lowerCAmelCase_ (				)->  None:






      '''simple docstring'''





      UpperCAmelCase    : Any      ='''Prehistoric Men.txt'''
      UpperCAmelCase    : Dict      ='''Output.txt'''
      UpperCAmelCase    : int      =int(input('''Enter key: '''						)						)
      UpperCAmelCase    : int      =input('''Encrypt/Decrypt [e/d]: '''						)

      if not os.path.exists(_UpperCAmelCase						):
            print(f'''File {input_file} does not exist. Quitting...'''						)
            sys.exit()
      if os.path.exists(_UpperCAmelCase						):
            print(f'''Overwrite {output_file}? [y/n]'''						)
            UpperCAmelCase    : List[str]      =input('''> '''						)
            if not response.lower().startswith('''y'''						):
                  sys.exit()

      UpperCAmelCase    : int      =time.time()
      if mode.lower().startswith('''e'''						):
            with open(_UpperCAmelCase						) as f:
                  UpperCAmelCase    : Any      =f.read()
            UpperCAmelCase    : int      =trans_cipher.encrypt_message(_UpperCAmelCase		,					_UpperCAmelCase						)
      elif mode.lower().startswith('''d'''						):
            with open(_UpperCAmelCase						) as f:
                  UpperCAmelCase    : Dict      =f.read()
            UpperCAmelCase    : Union[str, Any]      =trans_cipher.decrypt_message(_UpperCAmelCase		,					_UpperCAmelCase						)

      with open(_UpperCAmelCase		,					'''w'''						) as output_obj:
            output_obj.write(_UpperCAmelCase						)

      UpperCAmelCase    : Tuple      =round(time.time() - start_time		,					2						)
      print(('''Done (''', total_time, '''seconds )''')						)


if __name__ == "__main__":
     main()

def   lowerCAmelCase_ (				__lowerCAmelCase		,					__lowerCAmelCase						)->  list[tuple[int, int, int]]:






      '''simple docstring'''





      UpperCAmelCase    : List[Any]      =sorted(__lowerCAmelCase		,					key=lambda __lowerCAmelCase						: edge[2]						)

      UpperCAmelCase    : Union[str, Any]      =list(range(__lowerCAmelCase						)						)

      def find_parent(__lowerCAmelCase						):
            if i != parent[i]:
                  UpperCAmelCase    : Optional[int]      =find_parent(parent[i]						)
            return parent[i]

      UpperCAmelCase    : Optional[Any]      =0
      UpperCAmelCase    : List[str]      =[]

      for edge in edges:
            UpperCAmelCase    : Dict      =find_parent(edge[0]						)
            UpperCAmelCase    : Optional[Any]      =find_parent(edge[1]						)
            if parent_a != parent_b:
                  minimum_spanning_tree_cost += edge[2]
                  minimum_spanning_tree.append(__lowerCAmelCase						)
                  UpperCAmelCase    : Optional[Any]      =parent_b

      return minimum_spanning_tree


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

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

     kruskal(num_nodes, edges)
