'''simple docstring'''

from __future__ import annotations

A_     :						List[str]    							=[]



def snake_case_      (					__snake_case  :							list[list[int]]	,   __snake_case  :							int	,   __snake_case  :							int)			->					bool:
   for i in range(len(__snake_case)):
      if board[row][i] == 1:
         return False
   for i in range(len(__snake_case)):
      if board[i][column] == 1:
         return False
   for i, j in zip(range(__snake_case	,   -1	,   -1)	,   range(__snake_case	,   -1	,   -1)):
      if board[i][j] == 1:
         return False
   for i, j in zip(range(__snake_case	,   -1	,   -1)	,   range(__snake_case	,   len(__snake_case))):
      if board[i][j] == 1:
         return False
   return True



def snake_case_      (					__snake_case  :							list[list[int]]	,   __snake_case  :							int)			->					bool:
   if row >= len(__snake_case):
      solution.append(__snake_case)
      printboard(__snake_case)
      print()
      return True
   for i in range(len(__snake_case)):
      if is_safe(__snake_case	,   __snake_case	,   __snake_case):
         lowerCAmelCase_			=      1
         solve(__snake_case	,   row + 1)
         lowerCAmelCase_			=      0
   return False



def snake_case_      (					__snake_case  :							list[list[int]])			->					None:
   for i in range(len(__snake_case)):
      for j in range(len(__snake_case)):
         if board[i][j] == 1:
            print('''Q'''	,   end=''' ''')
         else:
            print('''.'''	,   end=''' ''')
      print()


# n=int(input("The no. of queens"))
A_     :						Optional[Any]    							=8
A_     :						Tuple    							=[[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'''

import os



def snake_case_      (					__snake_case  :							List[Any])			->					str:
   lowerCAmelCase_			=      len(grid[0])
   lowerCAmelCase_			=      len(__snake_case)

   lowerCAmelCase_			=      0
   lowerCAmelCase_			=      0
   lowerCAmelCase_			=      0

   # Check vertically, horizontally, diagonally at the same time (only works
   # for nxn grid)
   for i in range(__snake_case):
      for j in range(n_rows - 3):
         lowerCAmelCase_			=      grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
         lowerCAmelCase_			=      grid[i][j] * grid[i][j + 1] * grid[i][j + 2] * grid[i][j + 3]

         # Left-to-right diagonal (\) product
         if i < n_columns - 3:
            lowerCAmelCase_			=      (
                grid[i][j]
                * grid[i + 1][j + 1]
                * grid[i + 2][j + 2]
                * grid[i + 3][j + 3]
            )

         # Right-to-left diagonal(/) product
         if i > 2:
            lowerCAmelCase_			=      (
                grid[i][j]
                * grid[i - 1][j + 1]
                * grid[i - 2][j + 2]
                * grid[i - 3][j + 3]
            )

         lowerCAmelCase_			=      max(
             __snake_case	,   __snake_case	,   __snake_case	,   __snake_case)
         if max_product > largest:
            lowerCAmelCase_			=      max_product

   return largest



def snake_case_      (					)			->					List[Any]:
   lowerCAmelCase_			=      []
   with open(os.path.dirname(__snake_case) + '''/grid.txt''') as file:
      for line in file:
         grid.append(line.strip('''\n''').split(''' '''))

   lowerCAmelCase_			=      [[int(__snake_case) for i in grid[j]] for j in range(len(__snake_case))]

   return largest_product(__snake_case)


if __name__ == "__main__":
 print(solution())





