



'''simple docstring'''

from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset

class __snake_case(				_lowerCAmelCase ):


						'''simple docstring'''



						def     __snake_case   ( self				)     ->     Tuple:
							return [
							    {"col_1": 3, "col_2": "a"},
							    {"col_1": 2, "col_2": "b"},
							    {"col_1": 1, "col_2": "c"},
							    {"col_1": 0, "col_2": "d"},
							]


						def     __snake_case   ( self				)     ->     str:
							lowerCAmelCase   =     {"""col_1""": [3, 2, 1, 0], """col_2""": ["""a""", """b""", """c""", """d"""]}
							return Dataset.from_dict(A_				)


						def     __snake_case   ( self				)     ->     Optional[int]:
							lowerCAmelCase   =     self._create_example_records()
							lowerCAmelCase   =     Dataset.from_list(A_				)
							self.assertListEqual(dset.column_names     ,	["""col_1""", """col_2"""]				)
							for i, r in enumerate(A_				):
								self.assertDictEqual(A_     ,	example_records[i]				)


						def     __snake_case   ( self				)     ->     int:
							lowerCAmelCase   =     self._create_example_records()
							lowerCAmelCase   =     Dataset.from_list(A_				)
							lowerCAmelCase   =     Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]}				)
							self.assertEqual(dset.info     ,	dset_from_dict.info				)


						def     __snake_case   ( self				)     ->     List[Any]:  # checks what happens with missing columns
							lowerCAmelCase   =     [{"""col_1""": 1}, {"""col_2""": """x"""}]
							lowerCAmelCase   =     Dataset.from_list(A_				)
							self.assertDictEqual(dset[0]     ,	{"""col_1""": 1}				)
							self.assertDictEqual(dset[1]     ,	{"""col_1""": None}				)  # NB: first record is used for columns


						def     __snake_case   ( self				)     ->     str:  # checks if the type can be inferred from the second record
							lowerCAmelCase   =     [{"""col_1""": []}, {"""col_1""": [1, 2]}]
							lowerCAmelCase   =     Dataset.from_list(A_				)
							self.assertEqual(dset.info.features["""col_1"""]     ,	Sequence(Value("""int64"""				)				)				)




						def     __snake_case   ( self				)     ->     int:
							lowerCAmelCase   =     Dataset.from_list([]				)
							self.assertEqual(len(A_				)     ,	0				)
							self.assertListEqual(dset.column_names     ,	[]				)




'''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))