



def      __lowercase       (			a__       )    ->			Optional[int]:
							__SCREAMING_SNAKE_CASE									= [0] * len(a__       )
							__SCREAMING_SNAKE_CASE									= []
							__SCREAMING_SNAKE_CASE									= []
							__SCREAMING_SNAKE_CASE									= 0

							for values in graph.values():
														for i in values:
																					indegree[i] += 1

							for i in range(len(a__       )       ):
														if indegree[i] == 0:
																					queue.append(a__       )

							while queue:
														__SCREAMING_SNAKE_CASE									= queue.pop(0       )
														cnt += 1
														topo.append(a__       )
														for x in graph[vertex]:
																					indegree[x] -= 1
																					if indegree[x] == 0:
																												queue.append(a__       )

							if cnt != len(a__       ):
														print('Cycle exists'       )
							else:
														print(a__       )


# Adjacency List of Graph
lowerCAmelCase__		:					Optional[Any]							={0: [1, 2], 1: [3], 2: [3], 3: [4, 5], 4: [], 5: []}

topological_sort(graph)











import os






def      __lowercase       (			a__ = "input.txt"       )    ->			int:

							with open(os.path.join(os.path.dirname(a__       )							,       a__       )       ) as input_file:
														__SCREAMING_SNAKE_CASE									= [
														    [int(a__       ) for element in line.split(','       )]
														    for line in input_file.readlines()
														]

							__SCREAMING_SNAKE_CASE									= len(a__       )
							__SCREAMING_SNAKE_CASE									= len(matrix[0]       )

							__SCREAMING_SNAKE_CASE									= [[-1 for _ in range(a__       )] for _ in range(a__       )]
							for i in range(a__       ):
														__SCREAMING_SNAKE_CASE									= matrix[i][0]

							for j in range(1							,       a__       ):
														for i in range(a__       ):
																					__SCREAMING_SNAKE_CASE									= minimal_path_sums[i][j - 1] + matrix[i][j]

														for i in range(1							,       a__       ):
																					__SCREAMING_SNAKE_CASE									= min(
																					    minimal_path_sums[i][j]							,       minimal_path_sums[i - 1][j] + matrix[i][j]       )

														for i in range(rows - 2							,       -1							,       -1       ):
																					__SCREAMING_SNAKE_CASE									= min(
																					    minimal_path_sums[i][j]							,       minimal_path_sums[i + 1][j] + matrix[i][j]       )

							return min(minimal_path_sums_row[-1] for minimal_path_sums_row in minimal_path_sums       )


if __name__ == "__main__":
			print(F'''{solution() = }''')






