'''simple docstring'''

from __future__ import annotations

from collections import deque
from queue import Queue
from timeit import timeit

_A      :				Tuple 				=   {
    '''A''': ['''B''', '''C'''],
    '''B''': ['''A''', '''D''', '''E'''],
    '''C''': ['''A''', '''F'''],
    '''D''': ['''B'''],
    '''E''': ['''B''', '''F'''],
    '''F''': ['''C''', '''E'''],
}







def 					UpperCamelCase_						( snake_case_	:	dict						,		snake_case_	:	str				) ->					list[str]:






 '''simple docstring'''

 __lowerCAmelCase    							=						{start}
 __lowerCAmelCase    							=						[start]
 __lowerCAmelCase    							=						Queue()
 queue.put(snake_case_				)
 while not queue.empty():
  __lowerCAmelCase    							=						queue.get()
  for w in graph[v]:
   if w not in explored:
    explored.add(snake_case_				)
    result.append(snake_case_				)
    queue.put(snake_case_				)
 return result







def 					UpperCamelCase_						( snake_case_	:	dict						,		snake_case_	:	str				) ->					list[str]:






 '''simple docstring'''

 __lowerCAmelCase    							=						{start}
 __lowerCAmelCase    							=						[start]
 __lowerCAmelCase    							=						deque([start]				)
 while queue:
  __lowerCAmelCase    							=						queue.popleft()
  for child in graph[v]:
   if child not in visited:
    visited.add(snake_case_				)
    result.append(snake_case_				)
    queue.append(snake_case_				)
 return result







def 					UpperCamelCase_						( snake_case_	:	str				) ->					None:






 '''simple docstring'''

 __lowerCAmelCase    							=						f"""from __main__ import G, {name}"""
 __lowerCAmelCase    							=						1_00_00
 __lowerCAmelCase    							=						timeit(f"""{name}(G, 'A')"""						,		setup=snake_case_						,		number=snake_case_				)
 print(f"""{name:<35} finished {number} runs in {res:.5f} seconds"""				)


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 benchmark_function('''breadth_first_search''')
 benchmark_function('''breadth_first_search_with_deque''')
 # breadth_first_search                finished 10000 runs in 0.20999 seconds
 # breadth_first_search_with_deque     finished 10000 runs in 0.01421 seconds







'''simple docstring'''

def 					UpperCamelCase_						( snake_case_	:	int				) ->					int:






 '''simple docstring'''

 if number != int(snake_case_				):
  raise ValueError("""factorial() only accepts integral values"""				)
 if number < 0:
  raise ValueError("""factorial() not defined for negative values"""				)
 __lowerCAmelCase    							=						1
 for i in range(1						,		number + 1				):
  value *= i
 return value







def 					UpperCamelCase_						( snake_case_	:	int				) ->					int:






 '''simple docstring'''

 if not isinstance(snake_case_						,		snake_case_				):
  raise ValueError("""factorial() only accepts integral values"""				)
 if n < 0:
  raise ValueError("""factorial() not defined for negative values"""				)
 return 1 if n == 0 or n == 1 else n * factorial(n - 1				)


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 _A      :				List[Any] 				=    int(input('''Enter a positive integer: ''').strip() or 0)
 print(f'factorial{n} is {factorial(n)}')






