




def      A      (      _SCREAMING_SNAKE_CASE    )	-> Optional[Any]:
       lowerCamelCase   :      Tuple			 =					[0] * len(_SCREAMING_SNAKE_CASE    )
       lowerCamelCase   :      Tuple			 =					[]
       lowerCamelCase   :      Dict			 =					[1] * len(_SCREAMING_SNAKE_CASE    )

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

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

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

                     if long_dist[vertex] + 1 > long_dist[x]:
                            lowerCamelCase   :      Tuple			 =					long_dist[vertex] + 1

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

       print(max(_SCREAMING_SNAKE_CASE    )    )


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


longest_distance(graph)













import math







def  _SCREAMING_SNAKE_CASE				(   a  )      ->      list[int]:
					__A	:						List[str]       =				[]
					__A	:						Any       =				2
					__A	:						Union[str, Any]       =				int(math.sqrt(a  )  )  # Size of every segment
					__A	:						Any       =				[True] * (end + 1)
					__A	:						List[Any]       =				[]

					while start <= end:
										if temp[start] is True:
															in_prime.append(a  )
															for i in range(start * start					,						end + 1					,						a  ):
																				__A	:						Optional[int]       =				False
										start += 1
					prime += in_prime

					__A	:						Any       =				end + 1
					__A	:						Any       =				min(2 * end					,						a  )

					while low <= n:
										__A	:						List[Any]       =				[True] * (high - low + 1)
										for each in in_prime:
															__A	:						List[str]       =				math.floor(low / each  ) * each
															if t < low:
																				t += each

															for j in range(a					,						high + 1					,						a  ):
																				__A	:						Optional[int]       =				False

										for j in range(len(a  )  ):
															if temp[j] is True:
																				prime.append(j + low  )

										__A	:						Optional[int]       =				high + 1
										__A	:						Tuple       =				min(high + end					,						a  )

					return prime




print(sieve(10**6))




