
from __future__ import annotations

from collections import Counter



def      _a     (   __UpperCamelCase       :  int    ):
   lowerCAmelCase__ :    List[str]				      =			[True] * n
   lowerCAmelCase__ :    Optional[int]				      =			False
   lowerCAmelCase__ :    Optional[Any]				      =			False
   lowerCAmelCase__ :    str				      =			True

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

   lowerCAmelCase__ :    List[str]				      =			[2]

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

   return primes



def      _a     (   __UpperCamelCase       :  int    ):
   lowerCAmelCase__ :    List[str]				      =			str(__lowerCamelCase    )
   lowerCAmelCase__ :    str				      =			[]
   lowerCAmelCase__ :    str				      =			['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']

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

   return replacements



def      _a     (   __UpperCamelCase       :  int = 8    ):
   lowerCAmelCase__ :    List[Any]				      =			set()

   # Filter primes with less than 3 replaceable digits
   lowerCAmelCase__ :    Tuple				      =			{
       x for x in set(prime_sieve(100_0000    )    ) if len(str(__lowerCamelCase    )    ) - len(set(str(__lowerCamelCase    )    )    ) >= 3
   }

   for prime in primes:
      if prime in numbers_checked:
         continue

      lowerCAmelCase__ :    List[str]				      =			digit_replacements(__lowerCamelCase    )

      for family in replacements:
         numbers_checked.update(__lowerCamelCase    )
         lowerCAmelCase__ :    str				      =			primes.intersection(__lowerCamelCase    )

         if len(__lowerCamelCase    ) != family_length:
            continue

         return min(__lowerCamelCase    )

   return -1


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





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


A__       :   Union[str, Any]   						=					{"""configuration_cvt""": ["""CVT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CvtConfig"""]}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__       :   Union[str, Any]   						=					[
							    """CVT_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """CvtForImageClassification""",
							    """CvtModel""",
							    """CvtPreTrainedModel""",
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__       :   str   						=					[
							    """TF_CVT_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """TFCvtForImageClassification""",
							    """TFCvtModel""",
							    """TFCvtPreTrainedModel""",
							]

if TYPE_CHECKING:
							from .configuration_cvt import CVT_PRETRAINED_CONFIG_ARCHIVE_MAP, CvtConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_cvt import (
														    CVT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    CvtForImageClassification,
														    CvtModel,
														    CvtPreTrainedModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_cvt import (
														    TF_CVT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFCvtForImageClassification,
														    TFCvtModel,
														    TFCvtPreTrainedModel,
														)


else:
							import sys

							A__       :   Optional[Any]   						=					_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



