"""simple docstring"""







class      _lowercase						:

				def __init__(       self    :      int       ):


										'''simple docstring'''
										UpperCAmelCase__   		=						[0]
										UpperCAmelCase__   		=						0

				def     A	(       self    :      Optional[int]    ,      _lowercase    :      int       ):


										'''simple docstring'''
										UpperCAmelCase__   		=						self.__heap[i]
										while i // 2 > 0:
																if self.__heap[i] > self.__heap[i // 2]:
																						UpperCAmelCase__   		=						self.__heap[i // 2]
																						UpperCAmelCase__   		=						temporary
																i //= 2

				def     A	(       self    :      Any    ,      _lowercase    :      int       ):


										'''simple docstring'''
										self.__heap.append(__UpperCamelCase       )
										self.__size += 1
										self.__swap_up(self.__size       )

				def     A	(       self    :      Dict    ,      _lowercase    :      int       ):


										'''simple docstring'''
										while self.__size >= 2 * i:
																if 2 * i + 1 > self.__size:
																						UpperCAmelCase__   		=						2 * i
																else:
																						if self.__heap[2 * i] > self.__heap[2 * i + 1]:
																												UpperCAmelCase__   		=						2 * i
																						else:
																												UpperCAmelCase__   		=						2 * i + 1
																UpperCAmelCase__   		=						self.__heap[i]
																if self.__heap[i] < self.__heap[bigger_child]:
																						UpperCAmelCase__   		=						self.__heap[bigger_child]
																						UpperCAmelCase__   		=						temporary
																UpperCAmelCase__   		=						bigger_child

				def     A	(       self    :      Dict       ):


										'''simple docstring'''
										UpperCAmelCase__   		=						self.__heap[1]
										UpperCAmelCase__   		=						self.__heap[self.__size]
										self.__size -= 1
										self.__heap.pop()
										self.__swap_down(1       )
										return max_value

				@property
				def     A	(       self    :      Tuple       ):


										'''simple docstring'''
										return self.__heap[1:]

				def __len__(       self    :      List[str]       ):


										'''simple docstring'''
										return self.__size


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						# create an instance of BinaryHeap
						UpperCamelCase_    :    Union[str, Any]											=						BinaryHeap()
						binary_heap.insert(6)
						binary_heap.insert(10)
						binary_heap.insert(15)
						binary_heap.insert(12)
						# pop root(max-values because it is max heap)
						print(binary_heap.pop())  # 15
						print(binary_heap.pop())  # 12
						# get the list and size after operations
						print(binary_heap.get_list)
						print(len(binary_heap))


"""simple docstring"""







from __future__ import annotations

from collections import Counter


def 					a__ (						UpperCAmelCase__    :     int     )->		list[int]:
						UpperCAmelCase__   		=						[True] * n
						UpperCAmelCase__   		=						False
						UpperCAmelCase__   		=						False
						UpperCAmelCase__   		=						True

						for i in range(3						,     int(n**0.5 + 1     )						,     2     ):
												UpperCAmelCase__   		=						i * 2
												while index < n:
																		UpperCAmelCase__   		=						False
																		UpperCAmelCase__   		=						index + i

						UpperCAmelCase__   		=						[2]

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

						return primes


def 					a__ (						UpperCAmelCase__    :     int     )->		list[list[int]]:
						UpperCAmelCase__   		=						str(UpperCAmelCase__     )
						UpperCAmelCase__   		=						[]
						UpperCAmelCase__   		=						["""0""", """1""", """2""", """3""", """4""", """5""", """6""", """7""", """8""", """9"""]

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

						return replacements


def 					a__ (						UpperCAmelCase__    :     int = 8     )->		int:
						UpperCAmelCase__   		=						set()

						# Filter primes with less than 3 replaceable digits
						UpperCAmelCase__   		=						{
						    x for x in set(prime_sieve(1_0_0_0_0_0_0     )     ) if len(str(UpperCAmelCase__     )     ) - len(set(str(UpperCAmelCase__     )     )     ) >= 3
						}

						for prime in primes:
												if prime in numbers_checked:
																		continue

												UpperCAmelCase__   		=						digit_replacements(UpperCAmelCase__     )

												for family in replacements:
																		numbers_checked.update(UpperCAmelCase__     )
																		UpperCAmelCase__   		=						primes.intersection(UpperCAmelCase__     )

																		if len(UpperCAmelCase__     ) != family_length:
																								continue

																		return min(UpperCAmelCase__     )

						return -1


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

