




import heapq





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)   -> Optional[Any]:
 a		       =							[(0, start)]  # cost from start node,end node
 a		       =							set()
 while heap:
  ((a)       ,				(a))		       =							heapq.heappop(__lowerCamelCase					)
  if u in visited:
   continue
  visited.add(__lowerCamelCase					)
  if u == end:
   return cost
  for v, c in graph[u]:
   if v in visited:
    continue
   a		       =							cost + c
   heapq.heappush(__lowerCamelCase							,    (next_item, v)					)
 return -1


__UpperCamelCase      : Union[str, Any]					      =   {
    "A": [["B", 2], ["C", 5]],
    "B": [["A", 2], ["D", 3], ["E", 1], ["F", 1]],
    "C": [["A", 5], ["F", 3]],
    "D": [["B", 3]],
    "E": [["B", 4], ["F", 3]],
    "F": [["C", 3], ["E", 3]],
}
__UpperCamelCase      : Tuple					      =   {
    "B": [["C", 1]],
    "C": [["D", 1]],
    "D": [["F", 1]],
    "E": [["B", 1], ["F", 3]],
    "F": [],
}
__UpperCamelCase      : str					      =   {
    "B": [["C", 1]],
    "C": [["D", 1]],
    "D": [["F", 1]],
    "E": [["B", 1], ["G", 2]],
    "F": [],
    "G": [["F", 1]],
}

__UpperCamelCase      : Tuple					      =   dijkstra(G, "E", "C")
print(short_distance)  # E -- 3 --> F -- 3 --> C == 6

__UpperCamelCase      : Dict					      =   dijkstra(Ga, "E", "F")
print(short_distance)  # E -- 3 --> F == 3

__UpperCamelCase      : Any					      =   dijkstra(Ga, "E", "F")
print(short_distance)  # E -- 2 --> G -- 1 --> F == 3

if __name__ == "__main__":
  import doctest

  doctest.testmod()







__UpperCamelCase      : Union[str, Any]					      =   {
    "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	(			__lowerCamelCase					)   -> list[tuple[str, str]]:
	return [alphabet[char] for char in key.upper()]





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase					)   -> str:
	a		       =							""""""
	a		       =							0
	a		       =							generate_table(__lowerCamelCase					)
	for char in words.upper():
		cipher += get_opponent(table[count]							,    __lowerCamelCase					)
		a		       =							(count + 1) % len(__lowerCamelCase					)
	return cipher





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase					)   -> str:
	return encrypt(__lowerCamelCase							,    __lowerCamelCase					)





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase					)   -> tuple[int, int]:
	a		       =							0 if char in table[0] else 1
	a		       =							table[row].index(__lowerCamelCase					)
	return row, col





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase					)   -> str:
	a       ,				a		       =							get_position(__lowerCamelCase							,    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...
		__UpperCamelCase      : int					      =   input("Enter key: ").strip()
		__UpperCamelCase      : int					      =   input("Enter text to encrypt: ").strip()
		__UpperCamelCase      : Optional[Any]					      =   encrypt(key, text)

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

