
def 							__A(lowerCAmelCase )		->				Optional[Any]:

		"""simple docstring"""






		return [
		    {
		        0: [1, 2],
		        1: [0, 2],
		        2: [0, 1, 3, 5],
		        3: [2, 4],
		        4: [3],
		        5: [2, 6, 8],
		        6: [5, 7],
		        7: [6, 8],
		        8: [5, 7],
		    },
		    {
		        0: [6],
		        1: [9],
		        2: [4, 5],
		        3: [4],
		        4: [2, 3],
		        5: [2],
		        6: [0, 7],
		        7: [6],
		        8: [],
		        9: [1],
		    },
		    {
		        0: [4],
		        1: [6],
		        2: [],
		        3: [5, 6, 7],
		        4: [0, 6],
		        5: [3, 8, 9],
		        6: [1, 3, 4, 7],
		        7: [3, 6, 8, 9],
		        8: [5, 7],
		        9: [5, 7],
		    },
		    {
		        0: [1, 3],
		        1: [0, 2, 4],
		        2: [1, 3, 4],
		        3: [0, 2, 4],
		        4: [1, 2, 3],
		    },
		][index]


def 							__A(lowerCAmelCase )		->				list[tuple[int, int]]:

		"""simple docstring"""






		_UpperCamelCase						    =	0
		_UpperCamelCase						    =	len(lowerCAmelCase )  # No of vertices in graph
		_UpperCamelCase						    =	[0] * n
		_UpperCamelCase						    =	[False] * n

		def dfs(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase ):
				_UpperCamelCase						    =	True
				_UpperCamelCase						    =	id_
				id_ += 1
				for to in graph[at]:
						if to == parent:
								pass
						elif not visited[to]:
								dfs(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase						,  id_ )
								_UpperCamelCase						    =	min(low[at]						,  low[to] )
								if id_ <= low[to]:
										bridges.append((at, to) if at < to else (to, at) )
						else:
								# This edge is a back edge and cannot be a bridge
								_UpperCamelCase						    =	min(low[at]						,  low[to] )

		_UpperCamelCase						    =	[]
		for i in range(lowerCAmelCase ):
				if not visited[i]:
						dfs(lowerCAmelCase						,  -1						,  lowerCAmelCase						,  id_ )
		return bridges


if __name__ == "__main__":
		import doctest

		doctest.testmod()



from __future__ import annotations


def 							__A(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase						,  )		->				None:

		"""simple docstring"""






		_UpperCamelCase						    =	len(lowerCAmelCase )

		# If row is equal to the size of the board it means there are a queen in each row in
		# the current board (possible_board)
		if row == n:
				# We convert the variable possible_board that looks like this: [1, 3, 0, 2] to
				# this: ['. Q . . ', '. . . Q ', 'Q . . . ', '. . Q . ']
				boards.append([""". """ * i + """Q """ + """. """ * (n - 1 - i) for i in possible_board] )
				return

		# We iterate each column in the row to find all possible results in each row
		for col in range(lowerCAmelCase ):
				# We apply that we learned previously. First we check that in the current board
				# (possible_board) there are not other same value because if there is it means
				# that there are a collision in vertical. Then we apply the two formulas we
				# learned before:
				#
				# 45º: y - x = b or 45: row - col = b
				# 135º: y + x = b or row + col = b.
				#
				# And we verify if the results of this two formulas not exist in their variables
				# respectively.  (diagonal_right_collisions, diagonal_left_collisions)
				#
				# If any or these are True it means there is a collision so we continue to the
				# next value in the for loop.
				if (
				    col in possible_board
				    or row - col in diagonal_right_collisions
				    or row + col in diagonal_left_collisions
				):
						continue

				# If it is False we call dfs function again and we update the inputs
				depth_first_search(
				    [*possible_board, col]						,  [*diagonal_right_collisions, row - col]						,  [*diagonal_left_collisions, row + col]						,  lowerCAmelCase						,  lowerCAmelCase						,  )


def 							__A(lowerCAmelCase )		->				None:

		"""simple docstring"""






		_UpperCamelCase						    =	[]
		depth_first_search([]						,  []						,  []						,  lowerCAmelCase						,  lowerCAmelCase )

		# Print all the boards
		for board in boards:
				for column in board:
						print(lowerCAmelCase )
				print("""""" )

		print(len(lowerCAmelCase )						,  """solutions were found.""" )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		n_queens_solution(4)



