
def 				a						(							snake_case__:					int					):


				'''simple docstring'''
				lowercase_       =					[0] * len(snake_case__					)
				lowercase_       =					[]
				lowercase_       =					[1] * len(snake_case__					)

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

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

				while queue:
								lowercase_       =					queue.pop(0					)
								for x in graph[vertex]:
												indegree[x] -= 1

												if long_dist[vertex] + 1 > long_dist[x]:
																lowercase_       =					long_dist[vertex] + 1

												if indegree[x] == 0:
																queue.append(snake_case__					)

				print(max(snake_case__					)					)


# Adjacency list of Graph
__a  			=					{0: [2, 3, 4], 1: [2, 7], 2: [5], 3: [5, 7], 4: [7], 5: [6], 6: [7], 7: []}


longest_distance(graph)





'''simple docstring'''




def 				snake_case__							(			_A:					int      ,   _A:					int )    ->	int:

		'''simple docstring'''


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






def 				snake_case__							(			_A:					int      ,   _A:					int )    ->	int:

		'''simple docstring'''


		if gcd(_A      ,   _A ) != 1:
				lowerCAmelCase   					=  f"mod inverse of {a!r} and {m!r} does not exist"
				raise ValueError(_A )
		lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase   					=  1, 0, a
		lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase   					=  0, 1, m
		while va != 0:
				lowerCAmelCase   					=  ua // va
				lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase   					=  (ua - q * va), (ua - q * va), (ua - q * va), va, va, va
		return ua % m




