
import os




def        __UpperCamelCase					(    lowerCAmelCase__							:    int  ):
 __a			:  Optional[int]		    =  len(grid[0]  )
 __a			:  Optional[int]		    =  len(lowerCAmelCase__  )

 __a			:  Tuple		    =  0
 __a			:  int		    =  0
 __a			:  int		    =  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  ):
   __a			:  int		    =  grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
   __a			:  Union[str, Any]		    =  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:
    __a			:  Any		    =  (
        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:
    __a			:  Optional[Any]		    =  (
        grid[i][j]
        * grid[i - 1][j + 1]
        * grid[i - 2][j + 2]
        * grid[i - 3][j + 3]
    )

   __a			:  Union[str, Any]		    =  max(
       lowerCAmelCase__  ,       lowerCAmelCase__  ,       lowerCAmelCase__  ,       lowerCAmelCase__  )
   if max_product > largest:
    __a			:  List[str]		    =  max_product

 return largest




def        __UpperCamelCase					(    ):
 __a			:  Tuple		    =  []
 with open(os.path.dirname(lowerCAmelCase__  ) + '''/grid.txt'''  ) as file:
  for line in file:
   grid.append(line.strip('''\n'''  ).split(''' '''  )  )

 __a			:  Union[str, Any]		    =  [[int(lowerCAmelCase__  ) for i in grid[j]] for j in range(len(lowerCAmelCase__  )  )]

 return largest_product(lowerCAmelCase__  )


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


from transformers import BertTokenizerFast

from .custom_tokenization import CustomTokenizer



class 		UpperCamelCase__  (	__lowercase   ):
   _SCREAMING_SNAKE_CASE				:							Union[str, Any]     	=				CustomTokenizer
   pass
