



'''simple docstring'''

from __future__ import annotations






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						int = 4							)      ->						list[list[int]]:







	"""simple docstring"""
	lowerCAmelCase   =     abs(_SCREAMING_SNAKE_CASE							) or 4
	return [[1 + x + y * row_size for x in range(_SCREAMING_SNAKE_CASE							)] for y in range(_SCREAMING_SNAKE_CASE							)]






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						list[list[int]]:







	"""simple docstring"""
	return reverse_row(transpose(_SCREAMING_SNAKE_CASE							)							)
	# OR.. transpose(reverse_column(matrix))






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						list[list[int]]:







	"""simple docstring"""
	return reverse_row(reverse_column(_SCREAMING_SNAKE_CASE							)							)
	# OR.. reverse_column(reverse_row(matrix))






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						list[list[int]]:







	"""simple docstring"""
	return reverse_column(transpose(_SCREAMING_SNAKE_CASE							)							)
	# OR.. transpose(reverse_row(matrix))






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						list[list[int]]:







	"""simple docstring"""
	lowerCAmelCase   =     [list(_SCREAMING_SNAKE_CASE							) for x in zip(*_SCREAMING_SNAKE_CASE							)]
	return matrix






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						list[list[int]]:







	"""simple docstring"""
	lowerCAmelCase   =     matrix[::-1]
	return matrix






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						list[list[int]]:







	"""simple docstring"""
	lowerCAmelCase   =     [x[::-1] for x in matrix]
	return matrix






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						None:







	"""simple docstring"""
	for i in matrix:
		print(*_SCREAMING_SNAKE_CASE							)


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

				UpperCAmelCase     		=   make_matrix()
				print('\norigin:\n')
				print_matrix(matrix)
				print('\nrotate 180:\n')
				print_matrix(rotate_aaa(matrix))

				UpperCAmelCase     		=   make_matrix()
				print('\norigin:\n')
				print_matrix(matrix)
				print('\nrotate 270 counterclockwise:\n')
				print_matrix(rotate_aaa(matrix))




'''simple docstring'''

from __future__ import annotations

UpperCAmelCase     		=   []






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							,		_SCREAMING_SNAKE_CASE					:						int							,		_SCREAMING_SNAKE_CASE					:						int							)      ->						bool:







	"""simple docstring"""
	for i in range(len(_SCREAMING_SNAKE_CASE							)							):
		if board[row][i] == 1:
			return False
	for i in range(len(_SCREAMING_SNAKE_CASE							)							):
		if board[i][column] == 1:
			return False
	for i, j in zip(range(_SCREAMING_SNAKE_CASE							,		-1							,		-1							)							,		range(_SCREAMING_SNAKE_CASE							,		-1							,		-1							)							):
		if board[i][j] == 1:
			return False
	for i, j in zip(range(_SCREAMING_SNAKE_CASE							,		-1							,		-1							)							,		range(_SCREAMING_SNAKE_CASE							,		len(_SCREAMING_SNAKE_CASE							)							)							):
		if board[i][j] == 1:
			return False
	return True






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							,		_SCREAMING_SNAKE_CASE					:						int							)      ->						bool:







	"""simple docstring"""
	if row >= len(_SCREAMING_SNAKE_CASE							):
		solution.append(_SCREAMING_SNAKE_CASE							)
		printboard(_SCREAMING_SNAKE_CASE							)
		print()
		return True
	for i in range(len(_SCREAMING_SNAKE_CASE							)							):
		if is_safe(_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							):
			lowerCAmelCase   =     1
			solve(_SCREAMING_SNAKE_CASE							,		row + 1							)
			lowerCAmelCase   =     0
	return False






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						None:







	"""simple docstring"""
	for i in range(len(_SCREAMING_SNAKE_CASE							)							):
		for j in range(len(_SCREAMING_SNAKE_CASE							)							):
			if board[i][j] == 1:
				print("""Q"""							,		end=""" """							)
			else:
				print("""."""							,		end=""" """							)
		print()


# n=int(input("The no. of queens"))
UpperCAmelCase     		=   8
UpperCAmelCase     		=   [[0 for i in range(n)] for j in range(n)]
solve(board, 0)





print('The total no. of solutions are :', len(solution))