
'''simple docstring'''







def       snake_case_	(       __SCREAMING_SNAKE_CASE      :				int = 998001							):



						"""simple docstring"""





						lowercase_			:  Dict									= 0
						for i in range(999   ,   99   ,   -1							):  # 3 digit numbers range from 999 down to 100
												for j in range(999   ,   99   ,   -1							):
																		lowercase_			:  int									= str(i * j							)
																		if product_string == product_string[::-1] and i * j < n:
																								lowercase_			:  str									= max(__SCREAMING_SNAKE_CASE   ,   i * j							)
						return answer


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





'''simple docstring'''







from __future__ import annotations

from queue import Queue






class 				lowerCAmelCase__     :






					def __init__(     self	):


											"""simple docstring"""





											lowercase_			:  dict[int, list[int]]									= {}






					def 			_snake_case					(     self	):


											"""simple docstring"""





											for i in self.vertices:
																	print(__SCREAMING_SNAKE_CASE       ,							''' : '''       ,							''' -> '''.join([str(__SCREAMING_SNAKE_CASE	) for j in self.vertices[i]]	)	)






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											if from_vertex in self.vertices:
																	self.vertices[from_vertex].append(__SCREAMING_SNAKE_CASE	)
											else:
																	lowercase_			:  Optional[Any]									= [to_vertex]






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											lowercase_			:  List[Any]									= set()

											# create a first in first out queue to store all the vertices for BFS
											lowercase_			:  Queue									= Queue()

											# mark the source node as visited and enqueue it
											visited.add(__SCREAMING_SNAKE_CASE	)
											queue.put(__SCREAMING_SNAKE_CASE	)

											while not queue.empty():
																	lowercase_			:  List[Any]									= queue.get()

																	# loop through all adjacent vertex and enqueue it if not yet visited
																	for adjacent_vertex in self.vertices[vertex]:
																							if adjacent_vertex not in visited:
																													queue.put(__SCREAMING_SNAKE_CASE	)
																													visited.add(__SCREAMING_SNAKE_CASE	)
											return visited


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

							testmod(verbose=True)

							_lowercase				:						Optional[int]												= Graph()
							g.add_edge(0, 1)
							g.add_edge(0, 2)
							g.add_edge(1, 2)
							g.add_edge(2, 0)
							g.add_edge(2, 3)
							g.add_edge(3, 3)

							g.print_graph()
							# 0  :  1 -> 2
							# 1  :  2
							# 2  :  0 -> 3
							# 3  :  3

							assert sorted(g.bfs(2)) == [0, 1, 2, 3]



