
from __future__ import annotations

from queue import Queue
class 			lowercase__:



	"""simple docstring"""




	def __init__(	self  :      Optional[int]	)	->					None:
					lowercase_					  = {}
	def 						_lowercase  (	self  :      Dict	)	->					None:
					for i in self.vertices:
									print(SCREAMING_SNAKE_CASE_	,							''' : '''	,							''' -> '''.join([str(SCREAMING_SNAKE_CASE_	) for j in self.vertices[i]]	)	)
	def 						_lowercase  (	self  :      Optional[int]	,							SCREAMING_SNAKE_CASE_  :      int	,							SCREAMING_SNAKE_CASE_  :      int	)	->					None:
					if from_vertex in self.vertices:
									self.vertices[from_vertex].append(SCREAMING_SNAKE_CASE_	)
					else:
									lowercase_					  = [to_vertex]




	def 						_lowercase  (	self  :      Union[str, Any]	,							SCREAMING_SNAKE_CASE_  :      int	)	->					set[int]:
					lowercase_					  = set()

					# create a first in first out queue to store all the vertices for BFS
					lowercase_					  = 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_					  = 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)

						__a        = 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]






class 			lowercase__:



	"""simple docstring"""




	def __init__(	self  :      str	)	->					None:
					lowercase_					  = [0, 1]




	def 						_lowercase  (	self  :      str	,							SCREAMING_SNAKE_CASE_  :      int	)	->					list:
					if (difference := index - (len(self.sequence	) - 2)) >= 1:
									for _ in range(SCREAMING_SNAKE_CASE_	):
													self.sequence.append(self.sequence[-1] + self.sequence[-2]	)
					return self.sequence[:index]




def     a						(							):


				'''simple docstring'''
				print(
				    '''Fibonacci Series Using Dynamic Programming\n'''						,       '''Enter the index of the Fibonacci number you want to calculate '''						,       '''in the prompt below. (To exit enter exit or Ctrl-C)\n'''						,       sep=''''''						,       )
				lowercase_					  = Fibonacci()

				while True:
								lowercase_					  = input('''>> ''' )
								if prompt in {"exit", "quit"}:
												break

								try:
												lowercase_					  = int(snake_case__ )
								except ValueError:
												print('''Enter a number or \'exit\'''' )
												continue

								print(fibonacci.get(snake_case__ ) )


if __name__ == "__main__":
						main()




