






'''simple docstring'''


from __future__ import annotations







def 						__magic_name__(			_A    ,   _A       ):
						'''simple docstring'''





						UpperCamelCase__     , UpperCamelCase__     , UpperCamelCase__       =			"""""", """""", """"""
						UpperCamelCase__       =			[]

						for character in message_part:
												tmp.append(character_to_number[character]       )

						for each in tmp:
												one += each[0]
												two += each[1]
												three += each[2]

						return one + two + three







def 						__magic_name__(			_A    ,   _A       ):
						'''simple docstring'''





						UpperCamelCase__     , UpperCamelCase__       =			"""""", """"""
						UpperCamelCase__       =			[]

						for character in message_part:
												this_part += character_to_number[character]

						for digit in this_part:
												tmp += digit
												if len(_A       ) == len(_A       ):
																		result.append(_A       )
																		UpperCamelCase__       =			""""""

						return result[0], result[1], result[2]







def 						__magic_name__(			_A    ,   _A       ):
						'''simple docstring'''





						UpperCamelCase__       =			alphabet.replace(""" """    ,   """"""       ).upper()
						UpperCamelCase__       =			message.replace(""" """    ,   """"""       ).upper()

						# Check length and characters
						if len(_A       ) != 27:
												raise KeyError("""Length of alphabet has to be 27."""       )
						for each in message:
												if each not in alphabet:
																		raise ValueError("""Each message character has to be included in alphabet!"""       )

    # Generate dictionares
						UpperCamelCase__       =			(
						    """111""",
						    """112""",
						    """113""",
						    """121""",
						    """122""",
						    """123""",
						    """131""",
						    """132""",
						    """133""",
						    """211""",
						    """212""",
						    """213""",
						    """221""",
						    """222""",
						    """223""",
						    """231""",
						    """232""",
						    """233""",
						    """311""",
						    """312""",
						    """313""",
						    """321""",
						    """322""",
						    """323""",
						    """331""",
						    """332""",
						    """333""",
						)
						UpperCamelCase__       =			{}
						UpperCamelCase__       =			{}
						for letter, number in zip(_A    ,   _A       ):
												UpperCamelCase__       =			number
												UpperCamelCase__       =			letter

						return message, alphabet, character_to_number, number_to_character







def 						__magic_name__(			_A    ,   _A = "ABCDEFGHIJKLMNOPQRSTUVWXYZ."    ,   _A = 5       ):
						'''simple docstring'''





						UpperCamelCase__     , UpperCamelCase__     , UpperCamelCase__     , UpperCamelCase__       =			__prepare(
						    _A    ,   _A       )
						UpperCamelCase__     , UpperCamelCase__       =			"""""", """"""

						for i in range(0    ,   len(_A       ) + 1    ,   _A       ):
												encrypted_numeric += __encrypt_part(
												    message[i : i + period]    ,   _A       )

						for i in range(0    ,   len(_A       )    ,   3       ):
												encrypted += number_to_character[encrypted_numeric[i : i + 3]]

						return encrypted







def 						__magic_name__(			_A    ,   _A = "ABCDEFGHIJKLMNOPQRSTUVWXYZ."    ,   _A = 5       ):
						'''simple docstring'''





						UpperCamelCase__     , UpperCamelCase__     , UpperCamelCase__     , UpperCamelCase__       =			__prepare(
						    _A    ,   _A       )
						UpperCamelCase__       =			[]
						UpperCamelCase__       =			""""""

						for i in range(0    ,   len(_A       ) + 1    ,   _A       ):
												UpperCamelCase__     , UpperCamelCase__     , UpperCamelCase__       =			__decrypt_part(message[i : i + period]    ,   _A       )

												for j in range(0    ,   len(_A       )       ):
																		decrypted_numeric.append(a[j] + b[j] + c[j]       )

						for each in decrypted_numeric:
												decrypted += number_to_character[each]

						return decrypted


if __name__ == "__main__":
					lowerCamelCase_					:			List[Any]     						=				'''DEFEND THE EAST WALL OF THE CASTLE.'''
					lowerCamelCase_					:			Any     						=				encrypt_message(msg, '''EPSDUCVWYM.ZLKXNBTFGORIJHAQ''')
					lowerCamelCase_					:			Optional[Any]     						=				decrypt_message(encrypted, '''EPSDUCVWYM.ZLKXNBTFGORIJHAQ''')
					print(f"""Encrypted: {encrypted}\nDecrypted: {decrypted}""")








'''simple docstring'''


lowerCamelCase_					:			List[Any]     						=				{0: [1, 2], 1: [0, 3], 2: [0], 3: [1], 4: [5, 6], 5: [4, 6], 6: [4, 5]}

lowerCamelCase_					:			Tuple     						=				{0: [1, 2, 3], 1: [0, 3], 2: [0], 3: [0, 1], 4: [], 5: []}







def 						__magic_name__(			_A    ,   _A    ,   _A       ):
						'''simple docstring'''





						UpperCamelCase__       =			True
						UpperCamelCase__       =			[]

						for neighbour in graph[vert]:
												if not visited[neighbour]:
																		connected_verts += dfs(_A    ,   _A    ,   _A       )

						return [vert, *connected_verts]







def 						__magic_name__(			_A       ):
						'''simple docstring'''





						UpperCamelCase__       =			len(_A       )
						UpperCamelCase__       =			graph_size * [False]
						UpperCamelCase__       =			[]

						for i in range(_A       ):
												if not visited[i]:
																		UpperCamelCase__       =			dfs(_A    ,   _A    ,   _A       )
																		components_list.append(_A       )

						return components_list


if __name__ == "__main__":
					import doctest

					doctest.testmod()
