
'''simple docstring'''






from __future__ import annotations

from collections.abc import Iterator
from typing import Generic, TypeVar

A			      =      TypeVar('T')




class     __snake_case		(   Generic[T]):
					def __init__(     self,    A      ):

									"""simple docstring"""


									lowerCamelCase					:			Union[str, Any]									= data
									lowerCamelCase					:			Node[T] | None									= None




					def __str__(     self      ):

									"""simple docstring"""


									return F'''{self.data}'''





class     __snake_case		(   Generic[T]):
					def __init__(     self      ):

									"""simple docstring"""


									lowerCamelCase					:			Node[T] | None									= None
					def __iter__(     self      ):

									"""simple docstring"""


									lowerCamelCase					:			str									= self.top
									while node:
													yield node.data
													lowerCamelCase					:			Any									= node.next
					def __str__(     self      ):

									"""simple docstring"""


									return "->".join([str(A      ) for item in self]      )
					def __len__(     self      ):

									"""simple docstring"""


									return len(tuple(iter(self      )      )      )
					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									return self.top is None
					def     UpperCAmelCase_							(     self,    A      ):

									"""simple docstring"""


									lowerCamelCase					:			List[Any]									= Node(A      )
									if not self.is_empty():
													lowerCamelCase					:			str									= self.top
									lowerCamelCase					:			List[Any]									= node
					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									if self.is_empty():
													raise IndexError('pop from empty stack'      )
									assert isinstance(self.top,    A      )
									lowerCamelCase					:			List[str]									= self.top
									lowerCamelCase					:			Dict									= self.top.next
									return pop_node.data
					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									if self.is_empty():
													raise IndexError('peek from empty stack'      )

									assert self.top is not None
									return self.top.data




					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									lowerCamelCase					:			Optional[int]									= None


if __name__ == "__main__":
					from doctest import testmod

					testmod()


'''simple docstring'''






from __future__ import annotations





def    UpperCAmelCase							(  UpperCAmelCase__							:							int):
				lowerCamelCase					:			List[Any]									= str(UpperCAmelCase__)
				return len(UpperCAmelCase__) == 9 and set(UpperCAmelCase__) == set('123456789')





def    UpperCAmelCase							(  ):
				for base_num in range(99_99       ,							49_99       ,							-1):
								lowerCamelCase					:			Tuple									= 10_00_02 * base_num
								if is_9_pandigital(UpperCAmelCase__):
												return candidate

				for base_num in range(3_33       ,							99       ,							-1):
								lowerCamelCase					:			List[Any]									= 1_00_20_03 * base_num
								if is_9_pandigital(UpperCAmelCase__):
												return candidate

				return None


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