




def   A   (   _SCREAMING_SNAKE_CASE				,_SCREAMING_SNAKE_CASE					)			->				list[tuple[int, int, int]]:
       lowerCamelCase     :   Optional[Any]    				=      sorted(_SCREAMING_SNAKE_CASE				,key=lambda _SCREAMING_SNAKE_CASE					: edge[2]					)

       lowerCamelCase     :   str    				=      list(range(_SCREAMING_SNAKE_CASE					)					)

       def find_parent(_SCREAMING_SNAKE_CASE					):
              if i != parent[i]:
                     lowerCamelCase     :   Tuple    				=      find_parent(parent[i]					)
              return parent[i]

       lowerCamelCase     :   Union[str, Any]    				=      0
       lowerCamelCase     :   int    				=      []

       for edge in edges:
              lowerCamelCase     :   Any    				=      find_parent(edge[0]					)
              lowerCamelCase     :   Tuple    				=      find_parent(edge[1]					)
              if parent_a != parent_b:
                     minimum_spanning_tree_cost += edge[2]
                     minimum_spanning_tree.append(_SCREAMING_SNAKE_CASE					)
                     lowerCamelCase     :   List[Any]    				=      parent_b

       return minimum_spanning_tree


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

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

       kruskal(num_nodes, edges)












from itertools import compress, repeat
from math import ceil, sqrt

def   A   (   _SCREAMING_SNAKE_CASE					)			->				list[int]:

       if num <= 2:
              return []
       if num == 3:
              return [2]

       # Odd sieve for numbers in range [3, num - 1]
       lowerCamelCase     :   str    				=      bytearray(B"\x01"					) * ((num >> 1) - 1)

       for i in range(3				,int(sqrt(_SCREAMING_SNAKE_CASE					)					) + 1				,2					):
              if sieve[(i >> 1) - 1]:
                     lowerCamelCase     :   Tuple    				=      i**2
                     lowerCamelCase     :   str    				=      repeat(
                         0				,ceil((num - i_squared) / (i << 1)					)					)

       return [2] + list(compress(range(3				,_SCREAMING_SNAKE_CASE				,2					)				,_SCREAMING_SNAKE_CASE					)					)


if __name__ == "__main__":
       import doctest

       doctest.testmod()






