

A_						:     int			  =				{
    'A': ('ABCDEFGHIJKLM', 'NOPQRSTUVWXYZ'),
    'B': ('ABCDEFGHIJKLM', 'NOPQRSTUVWXYZ'),
    'C': ('ABCDEFGHIJKLM', 'ZNOPQRSTUVWXY'),
    'D': ('ABCDEFGHIJKLM', 'ZNOPQRSTUVWXY'),
    'E': ('ABCDEFGHIJKLM', 'YZNOPQRSTUVWX'),
    'F': ('ABCDEFGHIJKLM', 'YZNOPQRSTUVWX'),
    'G': ('ABCDEFGHIJKLM', 'XYZNOPQRSTUVW'),
    'H': ('ABCDEFGHIJKLM', 'XYZNOPQRSTUVW'),
    'I': ('ABCDEFGHIJKLM', 'WXYZNOPQRSTUV'),
    'J': ('ABCDEFGHIJKLM', 'WXYZNOPQRSTUV'),
    'K': ('ABCDEFGHIJKLM', 'VWXYZNOPQRSTU'),
    'L': ('ABCDEFGHIJKLM', 'VWXYZNOPQRSTU'),
    'M': ('ABCDEFGHIJKLM', 'UVWXYZNOPQRST'),
    'N': ('ABCDEFGHIJKLM', 'UVWXYZNOPQRST'),
    'O': ('ABCDEFGHIJKLM', 'TUVWXYZNOPQRS'),
    'P': ('ABCDEFGHIJKLM', 'TUVWXYZNOPQRS'),
    'Q': ('ABCDEFGHIJKLM', 'STUVWXYZNOPQR'),
    'R': ('ABCDEFGHIJKLM', 'STUVWXYZNOPQR'),
    'S': ('ABCDEFGHIJKLM', 'RSTUVWXYZNOPQ'),
    'T': ('ABCDEFGHIJKLM', 'RSTUVWXYZNOPQ'),
    'U': ('ABCDEFGHIJKLM', 'QRSTUVWXYZNOP'),
    'V': ('ABCDEFGHIJKLM', 'QRSTUVWXYZNOP'),
    'W': ('ABCDEFGHIJKLM', 'PQRSTUVWXYZNO'),
    'X': ('ABCDEFGHIJKLM', 'PQRSTUVWXYZNO'),
    'Y': ('ABCDEFGHIJKLM', 'OPQRSTUVWXYZN'),
    'Z': ('ABCDEFGHIJKLM', 'OPQRSTUVWXYZN'),
}


def  __a    (				SCREAMING_SNAKE_CASE ) ->       list[tuple[str, str]]:






    '''simple docstring'''
    return [alphabet[char] for char in key.upper()]


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       str:






    '''simple docstring'''
    __UpperCAmelCase			   =     ''''''
    __UpperCAmelCase			   =     0
    __UpperCAmelCase			   =     generate_table(SCREAMING_SNAKE_CASE )
    for char in words.upper():
        cipher += get_opponent(table[count]    ,				SCREAMING_SNAKE_CASE )
        __UpperCAmelCase			   =     (count + 1) % len(SCREAMING_SNAKE_CASE )
    return cipher


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       str:






    '''simple docstring'''
    return encrypt(SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE )


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       tuple[int, int]:






    '''simple docstring'''
    __UpperCAmelCase			   =     0 if char in table[0] else 1
    __UpperCAmelCase			   =     table[row].index(SCREAMING_SNAKE_CASE )
    return row, col


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       str:






    '''simple docstring'''
    __UpperCAmelCase   ,       __UpperCAmelCase			   =     get_position(SCREAMING_SNAKE_CASE    ,				char.upper() )
    if row == 1:
        return table[0][col]
    else:
        return table[1][col] if row == 0 else char


if __name__ == "__main__":
       import doctest

       doctest.testmod()  # Fist ensure that all our tests are passing...
       A_						:     List[str]			  =				input('Enter key: ').strip()
       A_						:     Union[str, Any]			  =				input('Enter text to encrypt: ').strip()
       A_						:     Tuple			  =				encrypt(key, text)

       print(F"""Encrypted: {cipher_text}""")
       print(F"""Decrypted with key: {decrypt(key, cipher_text)}""")







from __future__ import annotations

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

A_						:     Optional[int]			  =				{
    'A': ['B', 'C'],
    'B': ['A', 'D', 'E'],
    'C': ['A', 'F'],
    'D': ['B'],
    'E': ['B', 'F'],
    'F': ['C', 'E'],
}


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       list[str]:






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


def  __a    (				SCREAMING_SNAKE_CASE    ,				SCREAMING_SNAKE_CASE ) ->       list[str]:






    '''simple docstring'''
    __UpperCAmelCase			   =     {start}
    __UpperCAmelCase			   =     [start]
    __UpperCAmelCase			   =     deque([start] )
    while queue:
        __UpperCAmelCase			   =     queue.popleft()
        for child in graph[v]:
            if child not in visited:
                visited.add(SCREAMING_SNAKE_CASE )
                result.append(SCREAMING_SNAKE_CASE )
                queue.append(SCREAMING_SNAKE_CASE )
    return result


def  __a    (				SCREAMING_SNAKE_CASE ) ->       None:






    '''simple docstring'''
    __UpperCAmelCase			   =     f'''from __main__ import G, {name}'''
    __UpperCAmelCase			   =     1_0_0_0_0
    __UpperCAmelCase			   =     timeit(f'''{name}(G, \'A\')'''    ,				setup=SCREAMING_SNAKE_CASE    ,				number=SCREAMING_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




