





'''simple docstring'''

from __future__ import annotations







def 				UpperCAmelCase_     (						lowerCAmelCase_ = 4				):

				"""simple docstring"""






				lowercase    =			abs(__UpperCamelCase				) or 4
				return [[1 + x + y * row_size for x in range(__UpperCamelCase				)] for y in range(__UpperCamelCase				)]







def 				UpperCAmelCase_     (						lowerCAmelCase_				):

				"""simple docstring"""






				return reverse_row(transpose(__UpperCamelCase				)				)
				# OR.. transpose(reverse_column(matrix))







def 				UpperCAmelCase_     (						lowerCAmelCase_				):

				"""simple docstring"""






				return reverse_row(reverse_column(__UpperCamelCase				)				)
				# OR.. reverse_column(reverse_row(matrix))







def 				UpperCAmelCase_     (						lowerCAmelCase_				):

				"""simple docstring"""






				return reverse_column(transpose(__UpperCamelCase				)				)
				# OR.. transpose(reverse_row(matrix))







def 				UpperCAmelCase_     (						lowerCAmelCase_				):

				"""simple docstring"""






				lowercase    =			[list(__UpperCamelCase				) for x in zip(*__UpperCamelCase				)]
				return matrix







def 				UpperCAmelCase_     (						lowerCAmelCase_				):

				"""simple docstring"""






				lowercase    =			matrix[::-1]
				return matrix







def 				UpperCAmelCase_     (						lowerCAmelCase_				):

				"""simple docstring"""






				lowercase    =			[x[::-1] for x in matrix]
				return matrix







def 				UpperCAmelCase_     (						lowerCAmelCase_				):

				"""simple docstring"""






				for i in matrix:
								print(*__UpperCamelCase				)


if __name__ == "__main__":
			__lowerCamelCase			:			int									=      make_matrix()
			print("\norigin:\n")
			print_matrix(matrix)
			print("\nrotate 90 counterclockwise:\n")
			print_matrix(rotate_aa(matrix))

			__lowerCamelCase			:			Tuple									=      make_matrix()
			print("\norigin:\n")
			print_matrix(matrix)
			print("\nrotate 180:\n")
			print_matrix(rotate_aaa(matrix))

			__lowerCamelCase			:			Dict									=      make_matrix()
			print("\norigin:\n")
			print_matrix(matrix)
			print("\nrotate 270 counterclockwise:\n")
			print_matrix(rotate_aaa(matrix))









SCREAMING_SNAKE_CASE__   			=   {
    '''A''': ['''B''', '''C''', '''E'''],
    '''B''': ['''A''', '''D''', '''E'''],
    '''C''': ['''A''', '''F''', '''G'''],
    '''D''': ['''B'''],
    '''E''': ['''A''', '''B''', '''D'''],
    '''F''': ['''C'''],
    '''G''': ['''C'''],
}


def A    (							__UpperCamelCase			,						__UpperCamelCase			,						__UpperCamelCase       )    ->   list[str]:
			A__	  =     set()
			# keep track of all the paths to be checked
			A__	  =     [[start]]

			# return path if start is goal
			if start == goal:
						return [start]

			# keeps looping until all possible paths have been checked
			while queue:
						# pop the first path from the queue
						A__	  =     queue.pop(0       )
						# get the last node from the path
						A__	  =     path[-1]
						if node not in explored:
									A__	  =     graph[node]
									# go through all neighbour nodes, construct a new path and
									# push it into the queue
									for neighbour in neighbours:
												A__	  =     list(__UpperCamelCase       )
												new_path.append(__UpperCamelCase       )
												queue.append(__UpperCamelCase       )
												# return path if neighbour is goal
												if neighbour == goal:
															return new_path

            # mark node as explored
									explored.add(__UpperCamelCase       )

    # in case there's no path between the 2 nodes
			return []


def A    (							__UpperCamelCase			,						__UpperCamelCase			,						__UpperCamelCase       )    ->   int:
			if not graph or start not in graph or target not in graph:
						return -1
			if start == target:
						return 0
			A__	  =     [start]
			A__	  =     set(__UpperCamelCase       )
			# Keep tab on distances from `start` node.
			A__	  =     {start: 0, target: -1}
			while queue:
						A__	  =     queue.pop(0       )
						if node == target:
									A__	  =     (
									    dist[node] if dist[target] == -1 else min(dist[target]			,						dist[node]       )
									)
						for adjacent in graph[node]:
									if adjacent not in visited:
												visited.add(__UpperCamelCase       )
												queue.append(__UpperCamelCase       )
												A__	  =     dist[node] + 1
			return dist[target]


if __name__ == "__main__":
							print(bfs_shortest_path(demo_graph, '''G''', '''D'''))  # returns ['G', 'C', 'A', 'B', 'D']
							print(bfs_shortest_path_distance(demo_graph, '''G''', '''D'''))  # returns 4




