



"""simple docstring"""
A:   Optional[Any]								=		{0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

A:   Union[str, Any]								=		{0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}

def       _snake_case						(						UpperCamelCase						:		dict[int, list[int]]			,		UpperCamelCase						:		int			,		UpperCamelCase						:		list[bool]						):
 UpperCAmelCase	:					str	=	True
 UpperCAmelCase	:					int	=	[]

 for neighbour in graph[vert]:
  if not visited[neighbour]:
   order += topology_sort(_lowerCamelCase			,		_lowerCamelCase			,		_lowerCamelCase						)

 order.append(_lowerCamelCase						)

 return order

def       _snake_case						(						UpperCamelCase						:		dict[int, list[int]]			,		UpperCamelCase						:		int			,		UpperCamelCase						:		list[bool]						):
 UpperCAmelCase	:					str	=	True
 UpperCAmelCase	:					Optional[Any]	=	[vert]

 for neighbour in reversed_graph[vert]:
  if not visited[neighbour]:
   component += find_components(_lowerCamelCase			,		_lowerCamelCase			,		_lowerCamelCase						)

 return component

def       _snake_case						(						UpperCamelCase						:		dict[int, list[int]]						):
 UpperCAmelCase	:					Union[str, Any]	=	len(_lowerCamelCase						) * [False]
 UpperCAmelCase	:					dict[int, list[int]]	=	{vert: [] for vert in range(len(_lowerCamelCase						)						)}

 for vert, neighbours in graph.items():
  for neighbour in neighbours:
   reversed_graph[neighbour].append(_lowerCamelCase						)

 UpperCAmelCase	:					Any	=	[]
 for i, was_visited in enumerate(_lowerCamelCase						):
  if not was_visited:
   order += topology_sort(_lowerCamelCase			,		_lowerCamelCase			,		_lowerCamelCase						)

 UpperCAmelCase	:					Optional[int]	=	[]
 UpperCAmelCase	:					Tuple	=	len(_lowerCamelCase						) * [False]

 for i in range(len(_lowerCamelCase						)						):
  UpperCAmelCase	:					str	=	order[len(_lowerCamelCase						) - i - 1]
  if not visited[vert]:
   UpperCAmelCase	:					Dict	=	find_components(_lowerCamelCase			,		_lowerCamelCase			,		_lowerCamelCase						)
   components_list.append(_lowerCamelCase						)

 return components_list


import math




def 	_SCREAMING_SNAKE_CASE					(		)					->    None:






							'''simple docstring'''





							__UpperCamelCase	:   List[Any]			   =					input("Enter message: ")
							__UpperCamelCase	:   Optional[int]			   =					int(input(F'Enter key [2-{len(_lowerCamelCase) - 1}]: '))
							__UpperCamelCase	:   str			   =					input("Encryption/Decryption [e/d]: ")

							if mode.lower().startswith("e"):
														__UpperCamelCase	:   List[str]			   =					encrypt_message(_lowerCamelCase						,  _lowerCamelCase)
							elif mode.lower().startswith("d"):
														__UpperCamelCase	:   Dict			   =					decrypt_message(_lowerCamelCase						,  _lowerCamelCase)

							# Append pipe symbol (vertical bar) to identify spaces at the end.
							print(F'Output:\n{text + "|"}')




def 	_SCREAMING_SNAKE_CASE					(		_lowerCamelCase :			int						,  _lowerCamelCase :			str)					->    str:






							'''simple docstring'''





							__UpperCamelCase	:   Optional[Any]			   =					[""] * key
							for col in range(_lowerCamelCase):
														__UpperCamelCase	:   Any			   =					col
														while pointer < len(_lowerCamelCase):
																					cipher_text[col] += message[pointer]
																					pointer += key
							return "".join(_lowerCamelCase)




def 	_SCREAMING_SNAKE_CASE					(		_lowerCamelCase :			int						,  _lowerCamelCase :			str)					->    str:






							'''simple docstring'''





							__UpperCamelCase	:   Any			   =					math.ceil(len(_lowerCamelCase) / key)
							__UpperCamelCase	:   Any			   =					key
							__UpperCamelCase	:   str			   =					(num_cols * num_rows) - len(_lowerCamelCase)
							__UpperCamelCase	:   Union[str, Any]			   =					[""] * num_cols
							__UpperCamelCase	:   Dict			   =					0
							__UpperCamelCase	:   int			   =					0

							for symbol in message:
														plain_text[col] += symbol
														col += 1

														if (
														    (col == num_cols)
														    or (col == num_cols - 1)
														    and (row >= num_rows - num_shaded_boxes)
														):
																					__UpperCamelCase	:   List[Any]			   =					0
																					row += 1

							return "".join(_lowerCamelCase)


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		main()