



"""simple docstring"""






import os
import string
import sys


_lowercase			:			Union[str, Any]										=						1 << 8

_lowercase			:			Optional[int]										=						{
    "tab": ord("\t"),
    "newline": ord("\r"),
    "esc": 2_7,
    "up": 6_5 + ARROW_KEY_FLAG,
    "down": 6_6 + ARROW_KEY_FLAG,
    "right": 6_7 + ARROW_KEY_FLAG,
    "left": 6_8 + ARROW_KEY_FLAG,
    "mod_int": 9_1,
    "undefined": sys.maxsize,
    "interrupt": 3,
    "insert": 5_0,
    "delete": 5_1,
    "pg_up": 5_3,
    "pg_down": 5_4,
}

_lowercase			:			Union[str, Any]										=						KEYMAP["up"]
_lowercase			:			List[Any]										=						KEYMAP["left"]

if sys.platform == "win32":
		_lowercase			:			str										=						[]
		_lowercase			:			Optional[int]										=						{
		    B"\xe0H": KEYMAP["up"] - ARROW_KEY_FLAG,
		    B"\x00H": KEYMAP["up"] - ARROW_KEY_FLAG,
		    B"\xe0P": KEYMAP["down"] - ARROW_KEY_FLAG,
		    B"\x00P": KEYMAP["down"] - ARROW_KEY_FLAG,
		    B"\xe0M": KEYMAP["right"] - ARROW_KEY_FLAG,
		    B"\x00M": KEYMAP["right"] - ARROW_KEY_FLAG,
		    B"\xe0K": KEYMAP["left"] - ARROW_KEY_FLAG,
		    B"\x00K": KEYMAP["left"] - ARROW_KEY_FLAG,
		}

for i in range(1_0):
		_lowercase			:			Any										=						ord(str(i))






def 					snake_case__       (		):
			"""simple docstring"""
			if os.name == "nt":
						import msvcrt

						lowerCamelCase__		:		Optional[Any]		     ='''mbcs'''
						# Flush the keyboard buffer
						while msvcrt.kbhit():
									msvcrt.getch()
						if len(__lowerCamelCase     ) == 0:
									# Read the keystroke
									lowerCamelCase__		:		Optional[Any]		     =msvcrt.getch()

									# If it is a prefix char, get second part
									if ch in (b"\x00", b"\xe0"):
												lowerCamelCase__		:		str		     =ch + msvcrt.getch()
												# Translate actual Win chars to bullet char types
												try:
															lowerCamelCase__		:		str		     =chr(WIN_KEYMAP[cha]     )
															WIN_CH_BUFFER.append(chr(KEYMAP['''mod_int''']     )     )
															WIN_CH_BUFFER.append(__lowerCamelCase     )
															if ord(__lowerCamelCase     ) in (
															    KEYMAP["insert"] - 1 << 9,
															    KEYMAP["delete"] - 1 << 9,
															    KEYMAP["pg_up"] - 1 << 9,
															    KEYMAP["pg_down"] - 1 << 9,
															):
																		WIN_CH_BUFFER.append(chr(126     )     )
															lowerCamelCase__		:		Union[str, Any]		     =chr(KEYMAP['''esc''']     )
												except KeyError:
															lowerCamelCase__		:		str		     =cha[1]
									else:
												lowerCamelCase__		:		str		     =ch.decode(__lowerCamelCase     )
						else:
									lowerCamelCase__		:		Optional[Any]		     =WIN_CH_BUFFER.pop(0     )
			elif os.name == "posix":
						import termios
						import tty

						lowerCamelCase__		:		Dict		     =sys.stdin.fileno()
						lowerCamelCase__		:		str		     =termios.tcgetattr(__lowerCamelCase     )
						try:
									tty.setraw(__lowerCamelCase     )
									lowerCamelCase__		:		Union[str, Any]		     =sys.stdin.read(1     )
						finally:
									termios.tcsetattr(__lowerCamelCase							,		termios.TCSADRAIN							,		__lowerCamelCase     )
			return ch






def 					snake_case__       (		):
			"""simple docstring"""
			lowerCamelCase__		:		int		     =get_raw_chars()
			if ord(__lowerCamelCase     ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
						return char

			elif ord(__lowerCamelCase     ) == KEYMAP["esc"]:
						lowerCamelCase__		:		Tuple		     =get_raw_chars()
						if ord(__lowerCamelCase     ) == KEYMAP["mod_int"]:
									lowerCamelCase__		:		List[str]		     =get_raw_chars()
									if ord(__lowerCamelCase     ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(__lowerCamelCase     ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
												return chr(ord(__lowerCamelCase     ) + ARROW_KEY_FLAG     )
									else:
												return KEYMAP["undefined"]
						else:
									return get_raw_chars()

			else:
						if char in string.printable:
									return char
						else:
									return KEYMAP["undefined"]









"""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)




