
'''simple docstring'''

def        SCREAMING_SNAKE_CASE_  (	snake_case_				:	str							)       ->	str:
 SCREAMING_SNAKE_CASE  :  Dict								=		word.upper()
 SCREAMING_SNAKE_CASE  :  List[str]								=		0
 SCREAMING_SNAKE_CASE  :  Optional[Any]								=		{}
 SCREAMING_SNAKE_CASE  :  List[Any]								=		[]

 for letter in word:
  if letter not in letter_nums:
   SCREAMING_SNAKE_CASE  :  int								=		str(snake_case_							)
   next_num += 1
  word_pattern.append(letter_nums[letter]							)
 return ".".join(snake_case_							)


if __name__ == "__main__":
   import pprint
   import time

   __UpperCAmelCase												=   time.time()
   with open('dictionary.txt') as in_file:
      __UpperCAmelCase												=   in_file.read().splitlines()

   __UpperCAmelCase												=   {}
   for word in word_list:
      __UpperCAmelCase												=   get_word_pattern(word)
      if pattern in all_patterns:
         all_patterns[pattern].append(word)
      else:
         __UpperCAmelCase												=   [word]

   with open('word_patterns.txt', 'w') as out_file:
      out_file.write(pprint.pformat(all_patterns))

   __UpperCAmelCase												=   round(time.time() - start_time, 2)
   print(f"""Done!  {len(all_patterns):,} word patterns found in {total_time} seconds.""")
   # Done!  9,581 word patterns found in 0.58 seconds.




'''simple docstring'''

def        SCREAMING_SNAKE_CASE_  (	snake_case_				:	int   ,     snake_case_				:	list[tuple[int, int, int]]							)       ->	list[tuple[int, int, int]]:
 SCREAMING_SNAKE_CASE  :  List[Any]								=		sorted(snake_case_   ,     key=lambda snake_case_							: edge[2]							)

 SCREAMING_SNAKE_CASE  :  str								=		list(range(snake_case_							)							)

 def find_parent(snake_case_				:	Union[str, Any]							):
  if i != parent[i]:
   SCREAMING_SNAKE_CASE  :  int								=		find_parent(parent[i]							)
  return parent[i]

 SCREAMING_SNAKE_CASE  :  Union[str, Any]								=		0
 SCREAMING_SNAKE_CASE  :  Any								=		[]

 for edge in edges:
  SCREAMING_SNAKE_CASE  :  Dict								=		find_parent(edge[0]							)
  SCREAMING_SNAKE_CASE  :  Optional[int]								=		find_parent(edge[1]							)
  if parent_a != parent_b:
   minimum_spanning_tree_cost += edge[2]
   minimum_spanning_tree.append(snake_case_							)
   SCREAMING_SNAKE_CASE  :  Tuple								=		parent_b

 return minimum_spanning_tree


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

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

   kruskal(num_nodes, edges)


