'''simple docstring'''




class    a__				:






     def __init__(			self		:		List[Any]   ):





         """simple docstring"""



         __lowerCamelCase          =  {}






     def        SCREAMING_SNAKE_CASE__       (			self		:		Optional[int]   ):





         """simple docstring"""



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






     def        SCREAMING_SNAKE_CASE__       (			self		:		Any  ,    a		:		int  ,    a		:		int   ):





         """simple docstring"""



         if from_vertex in self.vertex:
             self.vertex[from_vertex].append(a   )
         else:
             # else make a new vertex
             __lowerCamelCase          =  [to_vertex]






     def        SCREAMING_SNAKE_CASE__       (			self		:		Optional[int]   ):





         """simple docstring"""



         __lowerCamelCase          =  [False] * len(self.vertex   )

         # call the recursive helper function
         for i in range(len(self.vertex   )   ):
             if not visited[i]:
                 self.dfs_recursive(a  ,    a   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		int  ,    a		:		int  ,    a		:		list   ):





         """simple docstring"""



         __lowerCamelCase          =  True

         print(a  ,    end=''' '''   )

         # Recur for all the vertices that are adjacent to this node
         for i in self.vertex:
             if not visited[i]:
                 self.dfs_recursive(a  ,    a   )


if __name__ == "__main__":
  __UpperCAmelCase												=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()
  print("DFS:")
  g.dfs()

  # OUTPUT:
  # 0  ->  1 -> 2
  # 1  ->  2
  # 2  ->  0 -> 3
  # 3  ->  3
  # DFS:
  #  0 1 2 3

'''simple docstring'''




__UpperCAmelCase												="ABCDEFGHIJKLMNOPQRSTUVWXYZ"






def __lowerCAmelCase			(							)     ->   None:
    __lowerCamelCase          =  input('''Enter message: '''    )
    __lowerCamelCase          =  input('''Enter key [alphanumeric]: '''    )
    __lowerCamelCase          =  input('''Encrypt/Decrypt [e/d]: '''    )

    if mode.lower().startswith('''e'''    ):
        __lowerCamelCase          =  '''encrypt'''
        __lowerCamelCase          =  encrypt_message(UpperCamelCase__    ,  UpperCamelCase__    )
    elif mode.lower().startswith('''d'''    ):
        __lowerCamelCase          =  '''decrypt'''
        __lowerCamelCase          =  decrypt_message(UpperCamelCase__    ,  UpperCamelCase__    )

    print(f"""\n{mode.title()}ed message:"""    )
    print(UpperCamelCase__    )






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    )     ->   str:
    return translate_message(UpperCamelCase__    ,  UpperCamelCase__    ,  '''encrypt'''    )






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    )     ->   str:
    return translate_message(UpperCamelCase__    ,  UpperCamelCase__    ,  '''decrypt'''    )






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    )     ->   str:
    __lowerCamelCase          =  []
    __lowerCamelCase          =  0
    __lowerCamelCase          =  key.upper()

    for symbol in message:
        __lowerCamelCase          =  LETTERS.find(symbol.upper()    )
        if num != -1:
            if mode == "encrypt":
                num += LETTERS.find(key[key_index]    )
            elif mode == "decrypt":
                num -= LETTERS.find(key[key_index]    )

            num %= len(UpperCamelCase__    )

            if symbol.isupper():
                translated.append(LETTERS[num]    )
            elif symbol.islower():
                translated.append(LETTERS[num].lower()    )

            key_index += 1
            if key_index == len(UpperCamelCase__    ):
                __lowerCamelCase          =  0
        else:
            translated.append(UpperCamelCase__    )
    return "".join(UpperCamelCase__    )


if __name__ == "__main__":
  main()
