





import heapq as hq
import math
from collections.abc import Iterator






class        _a:







		def __init__(    self ,						__snake_case				)      ->      List[Any]:


							'''simple docstring'''

							_snake_case       :					Tuple				       =   str(id_				)
							_snake_case       :					Union[str, Any]				       =   None
							_snake_case       :					int				       =   None
							_snake_case       :					Dict				       =   []
							_snake_case       :					int				       =   {}  # {vertex:distance}







		def __lt__(    self ,						__snake_case				)      ->      str:


							'''simple docstring'''

							return self.key < other.key







		def __repr__(    self				)      ->      int:


							'''simple docstring'''

							return self.id







		def        lowercase       (    self ,						__snake_case				)      ->      Tuple:


							'''simple docstring'''

							self.neighbors.append(__snake_case				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case				)      ->      List[str]:


							'''simple docstring'''

							_snake_case       :					Optional[Any]				       =   weight







def    A				(							UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase				):
					# add the neighbors:
					graph[a - 1].add_neighbor(graph[b - 1]				)
					graph[b - 1].add_neighbor(graph[a - 1]				)
					# add the edges:
					graph[a - 1].add_edge(graph[b - 1]  ,  __SCREAMING_SNAKE_CASE				)
					graph[b - 1].add_edge(graph[a - 1]  ,  __SCREAMING_SNAKE_CASE				)







def    A				(							UpperCAmelCase  ,  UpperCAmelCase				):
					_snake_case       :					Union[str, Any]				       =   []
					for u in graph:
										_snake_case       :					Union[str, Any]				       =   math.inf
										_snake_case       :					int				       =   None
					_snake_case       :					Dict				       =   0
					_snake_case       :					Optional[Any]				       =   graph[:]
					while q:
										_snake_case       :					List[str]				       =   min(__SCREAMING_SNAKE_CASE				)
										q.remove(__SCREAMING_SNAKE_CASE				)
										for v in u.neighbors:
															if (v in q) and (u.edges[v.id] < v.key):
																				_snake_case       :					List[Any]				       =   u
																				_snake_case       :					List[str]				       =   u.edges[v.id]
					for i in range(1  ,  len(__SCREAMING_SNAKE_CASE				)				):
										a.append((int(graph[i].id				) + 1, int(graph[i].pi.id				) + 1)				)
					return a







def    A				(							UpperCAmelCase  ,  UpperCAmelCase				):
					for u in graph:
										_snake_case       :					List[Any]				       =   math.inf
										_snake_case       :					Any				       =   None
					_snake_case       :					Dict				       =   0

					_snake_case       :					Optional[Any]				       =   list(__SCREAMING_SNAKE_CASE				)
					hq.heapify(__SCREAMING_SNAKE_CASE				)

					while h:
										_snake_case       :					Union[str, Any]				       =   hq.heappop(__SCREAMING_SNAKE_CASE				)
										for v in u.neighbors:
															if (v in h) and (u.edges[v.id] < v.key):
																				_snake_case       :					Dict				       =   u
																				_snake_case       :					str				       =   u.edges[v.id]
																				hq.heapify(__SCREAMING_SNAKE_CASE				)

					for i in range(1  ,  len(__SCREAMING_SNAKE_CASE				)				):
										yield (int(graph[i].id				) + 1, int(graph[i].pi.id				) + 1)







def    A				(							):
					pass


if __name__ == "__main__":
							import doctest

							doctest.testmod()






import sys
import turtle







def    A				(							UpperCAmelCase  ,  UpperCAmelCase				):
					return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2







def    A				(							UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  ):
					my_pen.up()
					my_pen.goto(vertexa[0]  ,  vertexa[1]				)
					my_pen.down()
					my_pen.goto(vertexa[0]  ,  vertexa[1]				)
					my_pen.goto(vertexa[0]  ,  vertexa[1]				)
					my_pen.goto(vertexa[0]  ,  vertexa[1]				)

					if depth == 0:
										return

					triangle(UpperCAmelCase  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  depth - 1				)
					triangle(UpperCAmelCase  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  depth - 1				)
					triangle(UpperCAmelCase  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  depth - 1				)


if __name__ == "__main__":
							if len(sys.argv) != 2:
														raise ValueError(
														    'Correct format for using this script: '
														    'python fractals.py <int:depth_for_fractal>'
														)
							__lowerCAmelCase :Any     =    turtle.Turtle()
							my_pen.ht()
							my_pen.speed(5)
							my_pen.pencolor('red')

							__lowerCAmelCase :Optional[int]     =    [(-1_75, -1_25), (0, 1_75), (1_75, -1_25)]  # vertices of triangle
							triangle(vertices[0], vertices[1], vertices[2], int(sys.argv[1]))