code: 
  
  
  """simple docstring"""
  
  
  
  
  def 			a_   (  lowercase__   :int, lowercase__   :list[tuple[int, int, int]]    ):
  			__lowerCamelCase        =			sorted(lowercase__, key=lambda lowercase__    : edge[2]    )
  
  			__lowerCamelCase        =			list(range(lowercase__    )    )
  
  			def find_parent(lowercase__   :int    ):
  						if i != parent[i]:
  									__lowerCamelCase        =			find_parent(parent[i]    )
  						return parent[i]
  
  			__lowerCamelCase        =			0
  			__lowerCamelCase        =			[]
  
  			for edge in edges:
  						__lowerCamelCase        =			find_parent(edge[0]    )
  						__lowerCamelCase        =			find_parent(edge[1]    )
  						if parent_a != parent_b:
  									minimum_spanning_tree_cost += edge[2]
  									minimum_spanning_tree.append(lowercase__    )
  									__lowerCamelCase        =			parent_b
  
  			return minimum_spanning_tree
  
  
  if __name__ == "__main__":  # pragma: no cover
  					__magic_name__          =							list(map(int, input().strip().split()))
  					__magic_name__          =							[]
  
  					for _ in range(num_edges):
  										__magic_name__          =							(int(x) for x in input().strip().split())
  										edges.append((nodea, nodea, cost))
  
  					kruskal(num_nodes, edges)
  
  
  
  
  
style_context: 
  
  
  """simple docstring"""
  
  
  
  
  import os
  
  
  
  
  
  def 			a_   (  ):
  			__lowerCamelCase        =			os.path.dirname(os.path.realpath(lowercase__    )    )
  			__lowerCamelCase        =			os.path.join(lowercase__, """triangle.txt"""    )
  
  			with open(lowercase__    ) as in_file:
  						__lowerCamelCase        =			[[int(lowercase__    ) for i in line.split()] for line in in_file]
  
  			while len(lowercase__    ) != 1:
  						__lowerCamelCase        =			triangle.pop()
  						__lowerCamelCase        =			triangle[-1]
  						for j in range(len(lowercase__    ) - 1    ):
  									curr_row[j] += max(last_row[j], last_row[j + 1]    )
  			return triangle[0][0]
  
  
  if __name__ == "__main__":
  					print(solution())
  
  
  
  
  