
"""simple docstring"""



import sys
from collections import defaultdict




class 		a_						:







    def __init__(			self			:       Any     )		->Dict:






        '''simple docstring'''






        _UpperCAmelCase          =   []







    def      _snake_case					(			self			:       int     ,					__UpperCamelCase			:       List[str]     )		->Dict:






        '''simple docstring'''






        return self.node_position[vertex]







    def      _snake_case					(			self			:       Optional[Any]     ,					__UpperCamelCase			:       Any     ,					__UpperCamelCase			:       List[str]     )		->Optional[Any]:






        '''simple docstring'''






        _UpperCAmelCase          =   pos







    def      _snake_case					(			self			:       List[Any]     ,					__UpperCamelCase			:       List[str]     ,					__UpperCamelCase			:       Dict     ,					__UpperCamelCase			:       Dict     ,					__UpperCamelCase			:       List[Any]     )		->Optional[int]:






        '''simple docstring'''






        if start > size // 2 - 1:
            return
        else:
            if 2 * start + 2 >= size:
                _UpperCAmelCase          =   2 * start + 1
            else:
                if heap[2 * start + 1] < heap[2 * start + 2]:
                    _UpperCAmelCase          =   2 * start + 1
                else:
                    _UpperCAmelCase          =   2 * start + 2
            if heap[smallest_child] < heap[start]:
                _UpperCAmelCase          =   heap[smallest_child], positions[smallest_child]
                _UpperCAmelCase          =   (
                    heap[start],
                    positions[start],
                )
                _UpperCAmelCase          =   temp, tempa

                _UpperCAmelCase          =   self.get_position(positions[smallest_child]     )
                self.set_position(
                    positions[smallest_child]     ,					self.get_position(positions[start]     )     )
                self.set_position(positions[start]     ,					__UpperCamelCase     )

                self.top_to_bottom(__UpperCamelCase     ,					__UpperCamelCase     ,					__UpperCamelCase     ,					__UpperCamelCase     )







    def      _snake_case					(			self			:       Union[str, Any]     ,					__UpperCamelCase			:       Tuple     ,					__UpperCamelCase			:       Tuple     ,					__UpperCamelCase			:       Union[str, Any]     ,					__UpperCamelCase			:       List[Any]     )		->Optional[int]:






        '''simple docstring'''






        _UpperCAmelCase          =   position[index]

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

            if val < heap[parent]:
                _UpperCAmelCase          =   heap[parent]
                _UpperCAmelCase          =   position[parent]
                self.set_position(position[parent]     ,					__UpperCamelCase     )
            else:
                _UpperCAmelCase          =   val
                _UpperCAmelCase          =   temp
                self.set_position(__UpperCamelCase     ,					__UpperCamelCase     )
                break
            _UpperCAmelCase          =   parent
        else:
            _UpperCAmelCase          =   val
            _UpperCAmelCase          =   temp
            self.set_position(__UpperCamelCase     ,					0     )







    def      _snake_case					(			self			:       Union[str, Any]     ,					__UpperCamelCase			:       int     ,					__UpperCamelCase			:       List[str]     )		->Union[str, Any]:






        '''simple docstring'''






        _UpperCAmelCase          =   len(__UpperCamelCase     ) // 2 - 1
        for i in range(__UpperCamelCase     ,					-1     ,					-1     ):
            self.top_to_bottom(__UpperCamelCase     ,					__UpperCamelCase     ,					len(__UpperCamelCase     )     ,					__UpperCamelCase     )







    def      _snake_case					(			self			:       Dict     ,					__UpperCamelCase			:       List[Any]     ,					__UpperCamelCase			:       Dict     )		->Optional[int]:






        '''simple docstring'''






        _UpperCAmelCase          =   positions[0]
        _UpperCAmelCase          =   sys.maxsize
        self.top_to_bottom(__UpperCamelCase     ,					0     ,					len(__UpperCamelCase     )     ,					__UpperCamelCase     )
        return temp







def  _UpperCamelCase	(						_A      )    ->  Optional[Any]:





    """simple docstring"""

    _UpperCAmelCase          =   Heap()

    _UpperCAmelCase          =   [0] * len(_lowerCamelCase      )
    _UpperCAmelCase          =   [-1] * len(_lowerCamelCase      )  # Neighboring Tree Vertex of selected vertex
    # Minimum Distance of explored vertex with neighboring vertex of partial tree
    # formed in graph
    _UpperCAmelCase          =   []  # Heap of Distance of vertices from their neighboring vertex
    _UpperCAmelCase          =   []

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

    _UpperCAmelCase          =   []
    _UpperCAmelCase          =   1
    _UpperCAmelCase          =   sys.maxsize
    for neighbor, distance in adjacency_list[0]:
        _UpperCAmelCase          =   0
        _UpperCAmelCase          =   distance
    heap.heapify(_lowerCamelCase					,      _lowerCamelCase      )

    for _ in range(1					,      len(_lowerCamelCase      )      ):
        _UpperCAmelCase          =   heap.delete_minimum(_lowerCamelCase					,      _lowerCamelCase      )
        if visited[vertex] == 0:
            tree_edges.append((nbr_tv[vertex], vertex)      )
            _UpperCAmelCase          =   1
            for neighbor, distance in adjacency_list[vertex]:
                if (
                    visited[neighbor] == 0
                    and distance < distance_tv[heap.get_position(_lowerCamelCase      )]
                ):
                    _UpperCAmelCase          =   distance
                    heap.bottom_to_top(
                        _lowerCamelCase					,      heap.get_position(_lowerCamelCase      )					,      _lowerCamelCase					,      _lowerCamelCase      )
                    _UpperCAmelCase          =   vertex
    return tree_edges


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

from PIL import Image  # type: ignore


def  _UpperCamelCase	(						_A					,      _A					,      _A      )    ->  float:





    """simple docstring"""

    _UpperCAmelCase          =   x
    _UpperCAmelCase          =   y
    for step in range(_A      ):  # noqa: B007
        _UpperCAmelCase          =   a * a - b * b + x
        _UpperCAmelCase          =   2 * a * b + y
        _UpperCAmelCase          =   a_new

        # divergence happens for all complex number with an absolute value
        # greater than 4
        if a * a + b * b > 4:
            break
    return step / (max_step - 1)


def  _UpperCamelCase	(						_A      )    ->  tuple:





    """simple docstring"""

    if distance == 1:
        return (0, 0, 0)
    else:
        return (2_5_5, 2_5_5, 2_5_5)


def  _UpperCamelCase	(						_A      )    ->  tuple:





    """simple docstring"""

    if distance == 1:
        return (0, 0, 0)
    else:
        return tuple(round(i * 2_5_5      ) for i in colorsys.hsv_to_rgb(_A					,      1					,      1      )      )


def  _UpperCamelCase	(						_A = 8_0_0					,      _A = 6_0_0					,      _A = -0.6					,      _A = 0					,      _A = 3.2					,      _A = 5_0					,      _A = True					,      )    ->  Image.Image:





    """simple docstring"""

    _UpperCAmelCase          =   Image.new("""RGB"""					,      (image_width, image_height)      )
    _UpperCAmelCase          =   img.load()

    # loop through the image-coordinates
    for image_x in range(_A      ):
        for image_y in range(_A      ):
            # determine the figure-coordinates based on the image-coordinates
            _UpperCAmelCase          =   figure_width / image_width * image_height
            _UpperCAmelCase          =   figure_center_x + (image_x / image_width - 0.5) * figure_width
            _UpperCAmelCase          =   figure_center_y + (image_y / image_height - 0.5) * figure_height

            _UpperCAmelCase          =   get_distance(_A					,      _A					,      _A      )

            # color the corresponding pixel based on the selected coloring-function
            if use_distance_color_coding:
                _UpperCAmelCase          =   get_color_coded_rgb(_A      )
            else:
                _UpperCAmelCase          =   get_black_and_white_rgb(_A      )

    return img


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 # colored version, full figure
 a					:	List[str]							=		get_image()

 # uncomment for colored version, different section, zoomed in
 # img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
 # figure_width = 0.8)

 # uncomment for black and white version, full figure
 # img = get_image(use_distance_color_coding = False)

 # uncomment to save the image
 # img.save("mandelbrot.png")

 img.show()