


"""simple docstring"""






from __future__ import annotations

from collections import Counter





def 							A_					(   snake_case__		)				->     list[int]:
			_UpperCamelCase				:Any				    =  [True] * n
			_UpperCamelCase				:Any				    =  False
			_UpperCamelCase				:Optional[int]				    =  False
			_UpperCamelCase				:Dict				    =  True

			for i in range(3					,				int(n**0.5 + 1		)					,				2		):
						_UpperCamelCase				:Optional[int]				    =  i * 2
						while index < n:
									_UpperCamelCase				:Dict				    =  False
									_UpperCamelCase				:List[Any]				    =  index + i

			_UpperCamelCase				:List[str]				    =  [2]

			for i in range(3					,				snake_case__					,				2		):
						if is_prime[i]:
									primes.append(snake_case__		)

			return primes





def 							A_					(   snake_case__		)				->     list[list[int]]:
			_UpperCamelCase				:Union[str, Any]				    =  str(snake_case__		)
			_UpperCamelCase				:int				    =  []
			_UpperCamelCase				:List[str]				    =  ['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']

			for duplicate in Counter(snake_case__		) - Counter(set(snake_case__		)		):
						_UpperCamelCase				:Optional[int]				    =  [int(number_str.replace(snake_case__					,				snake_case__		)		) for digit in digits]
						replacements.append(snake_case__		)

			return replacements





def 							A_					(   snake_case__ = 8		)				->     int:
			_UpperCamelCase				:Optional[int]				    =  set()

			# Filter primes with less than 3 replaceable digits
			_UpperCamelCase				:Union[str, Any]				    =  {
			    x for x in set(prime_sieve(1_00_00_00		)		) if len(str(snake_case__		)		) - len(set(str(snake_case__		)		)		) >= 3
			}

			for prime in primes:
						if prime in numbers_checked:
									continue

						_UpperCamelCase				:str				    =  digit_replacements(snake_case__		)

						for family in replacements:
									numbers_checked.update(snake_case__		)
									_UpperCamelCase				:int				    =  primes.intersection(snake_case__		)

									if len(snake_case__		) != family_length:
												continue

									return min(snake_case__		)

			return -1


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





"""simple docstring"""






class     A:

		"""simple docstring"""





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

					"""simple docstring"""



					_UpperCamelCase				:List[Any]				    =  []
					_UpperCamelCase				:Dict				    =  0
					_UpperCamelCase				:List[Any]				    =  0
		def __str__(   self      )			->  Optional[int]:

					"""simple docstring"""



					_UpperCamelCase				:Optional[Any]				    =  '''<''' + str(self.entries      )[1:-1] + '''>'''
					return printed
		def      _UpperCamelCase(   self				,							SCREAMING_SNAKE_CASE__      )			->  Tuple:

					"""simple docstring"""



					self.entries.append(SCREAMING_SNAKE_CASE__      )
					_UpperCamelCase				:Union[str, Any]				    =  self.length + 1
		def      _UpperCamelCase(   self      )			->  Dict:

					"""simple docstring"""



					_UpperCamelCase				:str				    =  self.length - 1
					_UpperCamelCase				:Optional[int]				    =  self.entries[self.front]
					# self.front-=1
					# self.entries = self.entries[self.front:]
					_UpperCamelCase				:Tuple				    =  self.entries[1:]
					return dequeued
		def      _UpperCamelCase(   self				,							SCREAMING_SNAKE_CASE__      )			->  str:

					"""simple docstring"""



					for _ in range(SCREAMING_SNAKE_CASE__      ):
								self.put(self.get()      )
		def      _UpperCamelCase(   self      )			->  str:

					"""simple docstring"""



					return self.entries[0]
		def      _UpperCamelCase(   self      )			->  Union[str, Any]:

					"""simple docstring"""



					return self.length

