





import os





def      _lowercase					(						_UpperCAmelCase				)						->  List[Any]:
				lowerCamelCase	 =len(grid[0]				)
				lowerCamelCase	 =len(_UpperCAmelCase				)

				lowerCamelCase	 =0
				lowerCamelCase	 =0
				lowerCamelCase	 =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				):
												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(
												    _UpperCAmelCase			,      _UpperCAmelCase			,      _UpperCAmelCase			,      _UpperCAmelCase				)
												if max_product > largest:
																lowerCamelCase	 =max_product

				return largest





def      _lowercase					(						)						->  Union[str, Any]:
				lowerCamelCase	 =[]
				with open(os.path.dirname(_UpperCAmelCase				) + """/grid.txt"""				) as file:
								for line in file:
												grid.append(line.strip("""\n"""				).split(""" """				)				)

				lowerCamelCase	 =[[int(_UpperCAmelCase				) for i in grid[j]] for j in range(len(_UpperCAmelCase				)				)]

				return largest_product(_UpperCAmelCase				)


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












from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
							if not (is_transformers_available() and is_torch_available()):
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							from ...utils.dummy_torch_and_transformers_objects import KandinskyPipeline, KandinskyPriorPipeline
else:
							from .pipeline_kandinsky import KandinskyPipeline
							from .pipeline_kandinsky_imgaimg import KandinskyImgaImgPipeline
							from .pipeline_kandinsky_inpaint import KandinskyInpaintPipeline
							from .pipeline_kandinsky_prior import KandinskyPriorPipeline, KandinskyPriorPipelineOutput
							from .text_encoder import MultilingualCLIP





