
"""simple docstring"""





import os







def 	__a     (		__lowerCamelCase  ):
   UpperCAmelCase_					:					List[Any]			     =    len(grid[0]  )
   UpperCAmelCase_					:					Tuple			     =    len(__lowerCamelCase  )

   UpperCAmelCase_					:					List[Any]			     =    0
   UpperCAmelCase_					:					List[str]			     =    0
   UpperCAmelCase_					:					Any			     =    0

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

         UpperCAmelCase_					:					Tuple			     =    max(
             __lowerCamelCase,		__lowerCamelCase,		__lowerCamelCase,		__lowerCamelCase  )
         if max_product > largest:
            UpperCAmelCase_					:					Any			     =    max_product

   return largest







def 	__a     (		):
   UpperCAmelCase_					:					List[Any]			     =    []
   with open(os.path.dirname(__lowerCamelCase  ) + "/grid.txt"  ) as file:
      for line in file:
         grid.append(line.strip("\n"  ).split(" "  )  )

   UpperCAmelCase_					:					Optional[int]			     =    [[int(__lowerCamelCase  ) for i in grid[j]] for j in range(len(__lowerCamelCase  )  )]

   return largest_product(__lowerCamelCase  )


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









"""simple docstring"""





def 			UpperCAmelCase__							(  SCREAMING_SNAKE_CASE     :						int							,						SCREAMING_SNAKE_CASE     :						int			):







      '''simple docstring'''




      while b:
            lowerCAmelCase						,		lowerCAmelCase  						=       b, a % b
      return a


def 			UpperCAmelCase__							(  SCREAMING_SNAKE_CASE     :						int							,						SCREAMING_SNAKE_CASE     :						int			):







      '''simple docstring'''




      return a if b == 0 else euclidean_gcd_recursive(SCREAMING_SNAKE_CASE							,						a % b			)


def 			UpperCAmelCase__							(  ):







      '''simple docstring'''




      print(F'euclidean_gcd(3, 5) = {euclidean_gcd(3							,						5			)}'			)
      print(F'euclidean_gcd(5, 3) = {euclidean_gcd(5							,						3			)}'			)
      print(F'euclidean_gcd(1, 3) = {euclidean_gcd(1							,						3			)}'			)
      print(F'euclidean_gcd(3, 6) = {euclidean_gcd(3							,						6			)}'			)
      print(F'euclidean_gcd(6, 3) = {euclidean_gcd(6							,						3			)}'			)

      print(F'euclidean_gcd_recursive(3, 5) = {euclidean_gcd_recursive(3							,						5			)}'			)
      print(F'euclidean_gcd_recursive(5, 3) = {euclidean_gcd_recursive(5							,						3			)}'			)
      print(F'euclidean_gcd_recursive(1, 3) = {euclidean_gcd_recursive(1							,						3			)}'			)
      print(F'euclidean_gcd_recursive(3, 6) = {euclidean_gcd_recursive(3							,						6			)}'			)
      print(F'euclidean_gcd_recursive(6, 3) = {euclidean_gcd_recursive(6							,						3			)}'			)


if __name__ == "__main__":
       main()






