




def __UpperCamelCase			(       _A  ):
						lowerCAmelCase_      			=  [0] * len(_A  )
						lowerCAmelCase_      			=  []
						lowerCAmelCase_      			=  []
						lowerCAmelCase_      			=  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:
												lowerCAmelCase_      			=  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
_A     =			{0: [1, 2], 1: [3], 2: [3], 3: [4, 5], 4: [], 5: []}






topological_sort(graph)










from functools import lru_cache





@lru_cache
def __UpperCamelCase			(       _A  ):
						if num < 0:
												raise ValueError('''Number should not be negative.'''  )

						return 1 if num in (0, 1) else num * factorial(num - 1  )


if __name__ == "__main__":
						import doctest

						doctest.testmod()




