




"""simple docstring"""
import random
import sys

from . import cryptomath_module as cryptomath

SCREAMING_SNAKE_CASE_			      =					(
    R''' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`'''
    R'''abcdefghijklmnopqrstuvwxyz{|}~'''
)

def 				lowercase      (_lowerCAmelCase				,  _lowerCAmelCase				,  _lowerCAmelCase		):
						if mode == "encrypt":
												if key_a == 1:
																		sys.exit(
																		    """The affine cipher becomes weak when key """
																		    """A is set to 1. Choose different key"""		)
												if key_b == 0:
																		sys.exit(
																		    """The affine cipher becomes weak when key """
																		    """B is set to 0. Choose different key"""		)
						if key_a < 0 or key_b < 0 or key_b > len(_lowerCAmelCase		) - 1:
												sys.exit(
												    """Key A must be greater than 0 and key B must """
												    f"""be between 0 and {len(_lowerCAmelCase		) - 1}."""		)
						if cryptomath.gcd(_lowerCAmelCase				,  len(_lowerCAmelCase		)		) != 1:
												sys.exit(
												    f"""Key A {key_a} and the symbol set size {len(_lowerCAmelCase		)} """
												    """are not relatively prime. Choose a different key."""		)

def 				lowercase      (_lowerCAmelCase				,  _lowerCAmelCase		):
						__lowerCAmelCase ,      __lowerCAmelCase        =       divmod(_lowerCAmelCase				,  len(_lowerCAmelCase		)		)
						check_keys(_lowerCAmelCase				,  _lowerCAmelCase				,  """encrypt"""		)
						__lowerCAmelCase        =       """"""
						for symbol in message:
												if symbol in SYMBOLS:
																		__lowerCAmelCase        =       SYMBOLS.find(_lowerCAmelCase		)
																		cipher_text += SYMBOLS[(sym_index * key_a + key_b) % len(_lowerCAmelCase		)]
												else:
																		cipher_text += symbol
						return cipher_text

def 				lowercase      (_lowerCAmelCase				,  _lowerCAmelCase		):
						__lowerCAmelCase ,      __lowerCAmelCase        =       divmod(_lowerCAmelCase				,  len(_lowerCAmelCase		)		)
						check_keys(_lowerCAmelCase				,  _lowerCAmelCase				,  """decrypt"""		)
						__lowerCAmelCase        =       """"""
						__lowerCAmelCase        =       cryptomath.find_mod_inverse(_lowerCAmelCase				,  len(_lowerCAmelCase		)		)
						for symbol in message:
												if symbol in SYMBOLS:
																		__lowerCAmelCase        =       SYMBOLS.find(_lowerCAmelCase		)
																		plain_text += SYMBOLS[
																		    (sym_index - key_b) * mod_inverse_of_key_a % len(_lowerCAmelCase		)
																		]
												else:
																		plain_text += symbol
						return plain_text

def 				lowercase      ():
						while True:
												__lowerCAmelCase        =       random.randint(2				,  len(_lowerCAmelCase		)		)
												__lowerCAmelCase        =       random.randint(2				,  len(_lowerCAmelCase		)		)
												if cryptomath.gcd(_lowerCAmelCase				,  len(_lowerCAmelCase		)		) == 1 and key_b % len(_lowerCAmelCase		) != 0:
																		return key_b * len(_lowerCAmelCase		) + key_b

def 				lowercase      ():
						__lowerCAmelCase        =       input("""Enter message: """		).strip()
						__lowerCAmelCase        =       int(input("""Enter key [2000 - 9000]: """		).strip()		)
						__lowerCAmelCase        =       input("""Encrypt/Decrypt [E/D]: """		).strip().lower()

						if mode.startswith("""e"""		):
												__lowerCAmelCase        =       """encrypt"""
												__lowerCAmelCase        =       encrypt_message(_lowerCAmelCase				,  _lowerCAmelCase		)
						elif mode.startswith("""d"""		):
												__lowerCAmelCase        =       """decrypt"""
												__lowerCAmelCase        =       decrypt_message(_lowerCAmelCase				,  _lowerCAmelCase		)
						print(f"""\n{mode.title()}ed text: \n{translated}"""		)


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			# main()


"""simple docstring"""
from __future__ import annotations
class      lowerCAmelCase_						:



							'''simple docstring'''





							def __init__(				self  ,							snake_case_							)   ->       None:
													__lowerCAmelCase        =       data
													__lowerCAmelCase        =       None
class      lowerCAmelCase_						:



							'''simple docstring'''





							def __init__(				self							)   ->       List[str]:
													__lowerCAmelCase        =       None




							def  A__		(				self  ,							snake_case_							)   ->       int:
													__lowerCAmelCase        =       Node(snake_case_							)
													__lowerCAmelCase        =       self.head
													__lowerCAmelCase        =       new_node
													return self.head.data




							def  A__		(				self							)   ->       int | None:
													__lowerCAmelCase        =       self.head
													__lowerCAmelCase        =       self.head
													if self.head:
																			while fast_pointer and fast_pointer.next:
																									__lowerCAmelCase        =       fast_pointer.next.next
																									__lowerCAmelCase        =       slow_pointer.next
																			return slow_pointer.data
													else:
																			print("""No element found."""							)
																			return None


if __name__ == "__main__":
			SCREAMING_SNAKE_CASE_			      =					LinkedList()
			for _ in range(int(input().strip())):
						SCREAMING_SNAKE_CASE_			      =					int(input().strip())
						link.push(data)
			print(link.middle_element())
