




import os

def    UpperCAmelCase_				( __UpperCAmelCase		:      str				)   ->					List[str]:
      SCREAMING_SNAKE_CASE_      		=     len(grid[0]				)
      SCREAMING_SNAKE_CASE_      		=     len(__UpperCAmelCase				)

      SCREAMING_SNAKE_CASE_      		=     0
      SCREAMING_SNAKE_CASE_      		=     0
      SCREAMING_SNAKE_CASE_      		=     0

      # Check vertically, horizontally, diagonally at the same time (only works
      # for nxn grid)
      for i in range(__UpperCAmelCase				):
            for j in range(n_rows - 3				):
                  SCREAMING_SNAKE_CASE_      		=     grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
                  SCREAMING_SNAKE_CASE_      		=     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:
                        SCREAMING_SNAKE_CASE_      		=     (
                            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:
                        SCREAMING_SNAKE_CASE_      		=     (
                            grid[i][j]
                            * grid[i - 1][j + 1]
                            * grid[i - 2][j + 2]
                            * grid[i - 3][j + 3]
                        )

                  SCREAMING_SNAKE_CASE_      		=     max(
                      __UpperCAmelCase     ,     __UpperCAmelCase     ,     __UpperCAmelCase     ,     __UpperCAmelCase				)
                  if max_product > largest:
                        SCREAMING_SNAKE_CASE_      		=     max_product

      return largest

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

      SCREAMING_SNAKE_CASE_      		=     [[int(__UpperCAmelCase				) for i in grid[j]] for j in range(len(__UpperCAmelCase				)				)]

      return largest_product(__UpperCAmelCase				)


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





from __future__ import annotations

from collections.abc import Iterator





class 			lowerCamelCase_				:


 '''simple docstring'''







 def __init__(				self    :						Union[str, Any]							,							_lowerCAmelCase    :						int		):
       SCREAMING_SNAKE_CASE_      		=     value
       SCREAMING_SNAKE_CASE_      		=     None
       SCREAMING_SNAKE_CASE_      		=     None





class 			lowerCamelCase_				:


 '''simple docstring'''







 def __init__(				self    :						int							,							_lowerCAmelCase    :						Node		):
       SCREAMING_SNAKE_CASE_      		=     tree



 def  lowerCAmelCase_    (				self    :						Union[str, Any]							,							_lowerCAmelCase    :						Node | None		):
       if node is None:
             return 0
       return node.value + (
           self.depth_first_search(node.left		) + self.depth_first_search(node.right		)
       )




 def __iter__(				self    :						Dict		):
       yield self.depth_first_search(self.tree		)


if __name__ == "__main__":
   import doctest

   doctest.testmod()