

"""simple docstring"""






from itertools import permutations
def 		A_	(   __UpperCamelCase     :				int = 5				):
		if gon_side < 3 or gon_side > 5:
				raise ValueError('''gon_side must be in the range [3, 5]'''				)

		# Since it's 16, we know 10 is on the outer ring
		# Put the big numbers at the end so that they are never the first number
		lowercase										=							list(range(gon_side + 1       ,	0       ,	-1				)				)
		lowercase										=							list(range(gon_side + 2       ,	gon_side * 2 + 1				)				)

		for perm in permutations(small_numbers + big_numbers				):
				lowercase										=							generate_gon_ring(__UpperCamelCase       ,	list(__UpperCamelCase				)				)
				if is_magic_gon(__UpperCamelCase				):
						return int(''''''.join(str(__UpperCamelCase				) for n in numbers				)				)

		lowercase										=							f"""Magic {gon_side}-gon ring is impossible"""
		raise ValueError(__UpperCamelCase				)
def 		A_	(   __UpperCamelCase     :				int       ,	__UpperCamelCase     :				list[int]				):
		lowercase										=							[0] * (gon_side * 3)
		lowercase										=							perm[0:3]
		perm.append(perm[1]				)

		lowercase										=							1 if gon_side < 5 else 2

		for i in range(1       ,	len(__UpperCamelCase				) // 3 + magic_number				):
				lowercase										=							perm[2 * i + 1]
				lowercase										=							result[3 * i - 1]
				lowercase										=							perm[2 * i + 2]

		return result
def 		A_	(   __UpperCamelCase     :				list[int]				):
		if len(__UpperCamelCase				) % 3 != 0:
				raise ValueError('''a gon ring should have a length that is a multiple of 3'''				)

		if min(numbers[::3]				) != numbers[0]:
				return False

		lowercase										=							sum(numbers[:3]				)

		return all(sum(numbers[i : i + 3]				) == total for i in range(3       ,	len(__UpperCamelCase				)       ,	3				)				)


if __name__ == "__main__":
							print(solution())


"""simple docstring"""






def 		A_	(   __UpperCamelCase     :				str       ,	__UpperCamelCase     :				str				):
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''plaintext must be a string'''				)
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''key must be a string'''				)

		if not plaintext:
				raise ValueError('''plaintext is empty'''				)
		if not key:
				raise ValueError('''key is empty'''				)

		key += plaintext
		lowercase										=							plaintext.lower()
		lowercase										=							key.lower()
		lowercase										=							0
		lowercase										=							0
		lowercase										=							''''''
		while plaintext_iterator < len(__UpperCamelCase				):
				if (
				    ord(plaintext[plaintext_iterator]				) < 97
				    or ord(plaintext[plaintext_iterator]				) > 1_22
				):
						ciphertext += plaintext[plaintext_iterator]
						plaintext_iterator += 1
				elif ord(key[key_iterator]				) < 97 or ord(key[key_iterator]				) > 1_22:
						key_iterator += 1
				else:
						ciphertext += chr(
						    (
						        (ord(plaintext[plaintext_iterator]				) - 97 + ord(key[key_iterator]				))
						        - 97
						    )
						    % 26
						    + 97				)
						key_iterator += 1
						plaintext_iterator += 1
		return ciphertext
def 		A_	(   __UpperCamelCase     :				str       ,	__UpperCamelCase     :				str				):
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''ciphertext must be a string'''				)
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''key must be a string'''				)

		if not ciphertext:
				raise ValueError('''ciphertext is empty'''				)
		if not key:
				raise ValueError('''key is empty'''				)

		lowercase										=							key.lower()
		lowercase										=							0
		lowercase										=							0
		lowercase										=							''''''
		while ciphertext_iterator < len(__UpperCamelCase				):
				if (
				    ord(ciphertext[ciphertext_iterator]				) < 97
				    or ord(ciphertext[ciphertext_iterator]				) > 1_22
				):
						plaintext += ciphertext[ciphertext_iterator]
				else:
						plaintext += chr(
						    (ord(ciphertext[ciphertext_iterator]				) - ord(key[key_iterator]				)) % 26
						    + 97				)
						key += chr(
						    (ord(ciphertext[ciphertext_iterator]				) - ord(key[key_iterator]				)) % 26
						    + 97				)
						key_iterator += 1
				ciphertext_iterator += 1
		return plaintext


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							__lowerCAmelCase				      =   int(input('''Type 1 to encrypt or 2 to decrypt:'''))
							if operation == 1:
														__lowerCAmelCase				      =   input('''Typeplaintext to be encrypted:\n''')
														__lowerCAmelCase				      =   input('''Type the key:\n''')
														print(encrypt(plaintext, key))
							elif operation == 2:
														__lowerCAmelCase				      =   input('''Type the ciphertext to be decrypted:\n''')
														__lowerCAmelCase				      =   input('''Type the key:\n''')
														print(decrypt(ciphertext, key))
							decrypt('''jsqqs avvwo''', '''coffee''')