






import sys
import turtle

def 	__lowerCamelCase      (		snake_case__	,snake_case__		)							->  tuple[float, float]:






						"""simple docstring"""





						return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2

def 	__lowerCamelCase      (		snake_case__	,snake_case__	,snake_case__	,snake_case__	,)							->  None:






						"""simple docstring"""





						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 	__lowerCamelCase      (		snake_case__	,snake_case__	,snake_case__		)							->  list[int]:






						"""simple docstring"""





						_SCREAMING_SNAKE_CASE     				=  True
						_SCREAMING_SNAKE_CASE     				=  []

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

						order.append(snake_case__		)

						return order

def 	__lowerCamelCase      (		snake_case__	,snake_case__	,snake_case__		)							->  list[int]:






						"""simple docstring"""





						_SCREAMING_SNAKE_CASE     				=  True
						_SCREAMING_SNAKE_CASE     				=  [vert]

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

						return component




def 	__lowerCamelCase      (		snake_case__		)							->  list[list[int]]:






						"""simple docstring"""





						_SCREAMING_SNAKE_CASE     				=  len(snake_case__		) * [False]
						_SCREAMING_SNAKE_CASE     				=  {vert: [] for vert in range(len(snake_case__		)		)}

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

						_SCREAMING_SNAKE_CASE     				=  []
						for i, was_visited in enumerate(snake_case__		):
												if not was_visited:
																		order += topology_sort(snake_case__	,snake_case__	,snake_case__		)

						_SCREAMING_SNAKE_CASE     				=  []
						_SCREAMING_SNAKE_CASE     				=  len(snake_case__		) * [False]

						for i in range(len(snake_case__		)		):
												_SCREAMING_SNAKE_CASE     				=  order[len(snake_case__		) - i - 1]
												if not visited[vert]:
																		_SCREAMING_SNAKE_CASE     				=  find_components(snake_case__	,snake_case__	,snake_case__		)
																		components_list.append(snake_case__		)

						return components_list

