



def      _A				(UpperCamelCase		:      int = 600851475143 )  ->int:



			'''simple docstring'''







			try:
						lowerCamelCase__ :      List[Any]								=		int(UpperCamelCase )
			except (TypeError, ValueError):
						raise TypeError("""Parameter n must be int or castable to int.""" )
			if n <= 0:
						raise ValueError("""Parameter n must be greater than or equal to one.""" )
			lowerCamelCase__ :      Dict								=		2
			lowerCamelCase__ :      Tuple								=		0
			if n == 2:
						return 2
			while n > 2:
						while n % i != 0:
									i += 1
						lowerCamelCase__ :      str								=		i
						while n % i == 0:
									lowerCamelCase__ :      Dict								=		n // i
						i += 1
			return int(UpperCamelCase )


if __name__ == "__main__":
							print(F'''{solution() = }''')








import itertools
import string
from collections.abc import Generator, Iterable






def      _A				(UpperCamelCase		:      Iterable[str]      ,			UpperCamelCase		:      int )  ->Generator[tuple[str, ...], None, None]:



			'''simple docstring'''







			lowerCamelCase__ :      Any								=		iter(UpperCamelCase )
			while True:
						lowerCamelCase__ :      Union[str, Any]								=		tuple(itertools.islice(UpperCamelCase      ,			UpperCamelCase ) )
						if not chunk:
									return
						yield chunk






def      _A				(UpperCamelCase		:      str )  ->str:



			'''simple docstring'''







			lowerCamelCase__ :      Tuple								=		"""""".join([c.upper() for c in dirty if c in string.ascii_letters] )
			lowerCamelCase__ :      Any								=		""""""

			if len(UpperCamelCase ) < 2:
						return dirty

			for i in range(len(UpperCamelCase ) - 1 ):
						clean += dirty[i]

						if dirty[i] == dirty[i + 1]:
									clean += "X"

			clean += dirty[-1]

			if len(UpperCamelCase ) & 1:
						clean += "X"

			return clean






def      _A				(UpperCamelCase		:      str )  ->list[str]:



			'''simple docstring'''







			lowerCamelCase__ :      Optional[Any]								=		"""ABCDEFGHIKLMNOPQRSTUVWXYZ"""
			# we're using a list instead of a '2d' array because it makes the math
			# for setting up the table and doing the actual encoding/decoding simpler
			lowerCamelCase__ :      List[Any]								=		[]

			# copy key chars into the table if they are in `alphabet` ignoring duplicates
			for char in key.upper():
						if char not in table and char in alphabet:
									table.append(UpperCamelCase )

    # fill the rest of the table in with the remaining alphabet chars
			for char in alphabet:
						if char not in table:
									table.append(UpperCamelCase )

			return table






def      _A				(UpperCamelCase		:      str      ,			UpperCamelCase		:      str )  ->str:



			'''simple docstring'''







			lowerCamelCase__ :      Tuple								=		generate_table(UpperCamelCase )
			lowerCamelCase__ :      int								=		prepare_input(UpperCamelCase )
			lowerCamelCase__ :      List[str]								=		""""""

			# https://en.wikipedia.org/wiki/Playfair_cipher#Description
			for chara, chara in chunker(UpperCamelCase      ,			2 ):
						lowerCamelCase__							,lowerCamelCase__ :      Optional[Any]								=		divmod(table.index(UpperCamelCase )      ,			5 )
						lowerCamelCase__							,lowerCamelCase__ :      Optional[Any]								=		divmod(table.index(UpperCamelCase )      ,			5 )

						if rowa == rowa:
									ciphertext += table[rowa * 5 + (cola + 1) % 5]
									ciphertext += table[rowa * 5 + (cola + 1) % 5]
						elif cola == cola:
									ciphertext += table[((rowa + 1) % 5) * 5 + cola]
									ciphertext += table[((rowa + 1) % 5) * 5 + cola]
						else:  # rectangle
									ciphertext += table[rowa * 5 + cola]
									ciphertext += table[rowa * 5 + cola]

			return ciphertext






def      _A				(UpperCamelCase		:      str      ,			UpperCamelCase		:      str )  ->str:



			'''simple docstring'''







			lowerCamelCase__ :      Any								=		generate_table(UpperCamelCase )
			lowerCamelCase__ :      Any								=		""""""

			# https://en.wikipedia.org/wiki/Playfair_cipher#Description
			for chara, chara in chunker(UpperCamelCase      ,			2 ):
						lowerCamelCase__							,lowerCamelCase__ :      int								=		divmod(table.index(UpperCamelCase )      ,			5 )
						lowerCamelCase__							,lowerCamelCase__ :      Any								=		divmod(table.index(UpperCamelCase )      ,			5 )

						if rowa == rowa:
									plaintext += table[rowa * 5 + (cola - 1) % 5]
									plaintext += table[rowa * 5 + (cola - 1) % 5]
						elif cola == cola:
									plaintext += table[((rowa - 1) % 5) * 5 + cola]
									plaintext += table[((rowa - 1) % 5) * 5 + cola]
						else:  # rectangle
									plaintext += table[rowa * 5 + cola]
									plaintext += table[rowa * 5 + cola]

			return plaintext



