



"""simple docstring"""





from __future__ import annotations

lowerCamelCase      	=						[]
def        a__     (				lowerCAmelCase__     ,      lowerCAmelCase__     ,      lowerCAmelCase__				):
      for i in range(len(lowerCAmelCase__				)				):
            if board[row][i] == 1:
                  return False
      for i in range(len(lowerCAmelCase__				)				):
            if board[i][column] == 1:
                  return False
      for i, j in zip(range(lowerCAmelCase__     ,      -1     ,      -1				)     ,      range(lowerCAmelCase__     ,      -1     ,      -1				)				):
            if board[i][j] == 1:
                  return False
      for i, j in zip(range(lowerCAmelCase__     ,      -1     ,      -1				)     ,      range(lowerCAmelCase__     ,      len(lowerCAmelCase__				)				)				):
            if board[i][j] == 1:
                  return False
      return True
def        a__     (				lowerCAmelCase__     ,      lowerCAmelCase__				):
      if row >= len(lowerCAmelCase__				):
            solution.append(lowerCAmelCase__				)
            printboard(lowerCAmelCase__				)
            print()
            return True
      for i in range(len(lowerCAmelCase__				)				):
            if is_safe(lowerCAmelCase__     ,      lowerCAmelCase__     ,      lowerCAmelCase__				):
                  UpperCAmelCase_      			=							1
                  solve(lowerCAmelCase__     ,      row + 1				)
                  UpperCAmelCase_      			=							0
      return False
def        a__     (				lowerCAmelCase__				):
      for i in range(len(lowerCAmelCase__				)				):
            for j in range(len(lowerCAmelCase__				)				):
                  if board[i][j] == 1:
                        print("Q"     ,      end=" "				)
                  else:
                        print("."     ,      end=" "				)
            print()


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


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









"""simple docstring"""





from collections.abc import Iterable
from typing import Generic, TypeVar

lowerCamelCase       	=						TypeVar("""_T""")
class 				lowercase__       (   Generic[_T]				):







       '''simple docstring'''


       def __init__(							self      :  int		,    _UpperCAmelCase      :  Iterable[_T] | None = None   )			->						None:


             '''simple docstring'''




             UpperCAmelCase_      			=							list(iterable or []   )
             UpperCAmelCase_      			=							[]



       def __len__(							self      :  Optional[int]   )			->						int:


             '''simple docstring'''




             return len(self._stacka   ) + len(self._stacka   )



       def __repr__(							self      :  Optional[Any]   )			->						str:


             '''simple docstring'''




             return F"""Queue({tuple(self._stacka[::-1] + self._stacka   )})"""



       def 					lowercase__    (							self      :  Optional[Any]		,    _UpperCAmelCase      :  _T   )			->						None:


             '''simple docstring'''




             self._stacka.append(_UpperCAmelCase   )







       def 					lowercase__    (							self      :  Dict   )			->						_T:


             '''simple docstring'''




             UpperCAmelCase_      			=							self._stacka.pop
             UpperCAmelCase_      			=							self._stacka.append

             if not self._stacka:
                   while self._stacka:
                         stacka_append(stacka_pop()   )

             if not self._stacka:
                   raise IndexError("Queue is empty"   )
             return self._stacka.pop()


if __name__ == "__main__":
  from doctest import testmod

  testmod()




