



"""simple docstring"""






def 					snake_case__       (		__lowerCamelCase    :   Tuple     ):
			"""simple docstring"""
			lowerCamelCase__		:		Optional[int]		     =min(__lowerCamelCase     )  # min() finds the minimum value
			lowerCamelCase__		:		Tuple		     =max(__lowerCamelCase     )  # max() finds the maximum value

			lowerCamelCase__		:		List[Any]		     =max_val - min_val + 1  # size is difference of max and min values plus one

			# list of pigeonholes of size equal to the variable size
			lowerCamelCase__		:		str		     =[0] * size

			# Populate the pigeonholes.
			for x in a:
						assert isinstance(__lowerCamelCase							,		__lowerCamelCase     ), "integers only please"
						holes[x - min_val] += 1

			# Putting the elements back into the array in an order.
			lowerCamelCase__		:		List[str]		     =0
			for count in range(__lowerCamelCase     ):
						while holes[count] > 0:
									holes[count] -= 1
									lowerCamelCase__		:		int		     =count + min_val
									i += 1






def 					snake_case__       (		):
			"""simple docstring"""
			lowerCamelCase__		:		Dict		     =[8, 3, 2, 7, 4, 6, 8]
			pigeonhole_sort(__lowerCamelCase     )
			print('''Sorted order is:'''							,		''' '''.join(__lowerCamelCase     )     )


if __name__ == "__main__":
		main()









"""simple docstring"""






def 					snake_case__       (		__lowerCamelCase    :   int     ):
			"""simple docstring"""
			lowerCamelCase__		:		List[Any]		     =[0] * len(__lowerCamelCase     )
			lowerCamelCase__		:		List[Any]		     =[]
			lowerCamelCase__		:		List[Any]		     =[1] * len(__lowerCamelCase     )

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

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

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

									if long_dist[vertex] + 1 > long_dist[x]:
												lowerCamelCase__		:		Optional[Any]		     =long_dist[vertex] + 1

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

			print(max(__lowerCamelCase     )     )


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

longest_distance(graph)




