





import sys
import turtle






def 	_SCREAMING_SNAKE_CASE		(      SCREAMING_SNAKE_CASE		:tuple[float, float]   ,   SCREAMING_SNAKE_CASE		:tuple[float, float]   )      ->   tuple[float, float]:
 return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2






def 	_SCREAMING_SNAKE_CASE		(      SCREAMING_SNAKE_CASE		:tuple[float, float]   ,   SCREAMING_SNAKE_CASE		:tuple[float, float]   ,   SCREAMING_SNAKE_CASE		:tuple[float, float]   ,   SCREAMING_SNAKE_CASE		:int   ,   )      ->   None:
 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(SCREAMING_SNAKE_CASE   ,   get_mid(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )   ,   get_mid(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )   ,   depth - 1   )
 triangle(SCREAMING_SNAKE_CASE   ,   get_mid(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )   ,   get_mid(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )   ,   depth - 1   )
 triangle(SCREAMING_SNAKE_CASE   ,   get_mid(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )   ,   get_mid(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )   ,   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>'
            )
      _UpperCAmelCase             =							turtle.Turtle()
      my_pen.ht()
      my_pen.speed(5)
      my_pen.pencolor('red')

      _UpperCAmelCase             =							[(-175, -125), (0, 175), (175, -125)]  # vertices of triangle
      triangle(vertices[0], vertices[1], vertices[2], int(sys.argv[1]))






_UpperCAmelCase             =							{0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

_UpperCAmelCase             =							{0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}






def 	_SCREAMING_SNAKE_CASE		(      SCREAMING_SNAKE_CASE		:dict[int, list[int]]   ,   SCREAMING_SNAKE_CASE		:int   ,   SCREAMING_SNAKE_CASE		:list[bool]   )      ->   list[int]:
 __lowerCAmelCase					:	str      =       True
 __lowerCAmelCase					:	str      =       []

 for neighbour in graph[vert]:
  if not visited[neighbour]:
   order += topology_sort(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )

 order.append(SCREAMING_SNAKE_CASE   )

 return order






def 	_SCREAMING_SNAKE_CASE		(      SCREAMING_SNAKE_CASE		:dict[int, list[int]]   ,   SCREAMING_SNAKE_CASE		:int   ,   SCREAMING_SNAKE_CASE		:list[bool]   )      ->   list[int]:
 __lowerCAmelCase					:	Optional[Any]      =       True
 __lowerCAmelCase					:	Union[str, Any]      =       [vert]

 for neighbour in reversed_graph[vert]:
  if not visited[neighbour]:
   component += find_components(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )

 return component







def 	_SCREAMING_SNAKE_CASE		(      SCREAMING_SNAKE_CASE		:dict[int, list[int]]   )      ->   list[list[int]]:
 __lowerCAmelCase					:	Optional[Any]      =       len(SCREAMING_SNAKE_CASE   ) * [False]
 __lowerCAmelCase					:	dict[int, list[int]]      =       {vert: [] for vert in range(len(SCREAMING_SNAKE_CASE   )   )}

 for vert, neighbours in graph.items():
  for neighbour in neighbours:
   reversed_graph[neighbour].append(SCREAMING_SNAKE_CASE   )

 __lowerCAmelCase					:	Tuple      =       []
 for i, was_visited in enumerate(SCREAMING_SNAKE_CASE   ):
  if not was_visited:
   order += topology_sort(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )

 __lowerCAmelCase					:	Optional[Any]      =       []
 __lowerCAmelCase					:	Any      =       len(SCREAMING_SNAKE_CASE   ) * [False]

 for i in range(len(SCREAMING_SNAKE_CASE   )   ):
  __lowerCAmelCase					:	Optional[int]      =       order[len(SCREAMING_SNAKE_CASE   ) - i - 1]
  if not visited[vert]:
   __lowerCAmelCase					:	Any      =       find_components(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )
   components_list.append(SCREAMING_SNAKE_CASE   )

 return components_list