


import functools






def 							__lowercase       (			__lowerCAmelCase							:    str ,   __lowerCAmelCase							:    str       ):
							a__					=					len(__lowerCAmelCase       )
							a__					=					len(__lowerCAmelCase       )

							@functools.cache
							def min_distance(__lowerCAmelCase							:    int ,   __lowerCAmelCase							:    int       ) -> int:
														# if first word index is overflow - delete all from the second word
														if indexa >= len_worda:
																					return len_worda - indexa
														# if second word index is overflow - delete all from the first word
														if indexa >= len_worda:
																					return len_worda - indexa
														a__					=					int(worda[indexa] != worda[indexa]       )  # current letters not identical
														return min(
														    1 + min_distance(indexa + 1 ,   __lowerCAmelCase       ) ,   1 + min_distance(__lowerCAmelCase ,   indexa + 1       ) ,   diff + min_distance(indexa + 1 ,   indexa + 1       ) ,   )

							return min_distance(0 ,   0       )


if __name__ == "__main__":
						import doctest

						doctest.testmod()








def 							__lowercase       (			__lowerCAmelCase							:    Optional[Any]       ):
							return [
							    {
							        0: [1, 2],
							        1: [0, 2],
							        2: [0, 1, 3, 5],
							        3: [2, 4],
							        4: [3],
							        5: [2, 6, 8],
							        6: [5, 7],
							        7: [6, 8],
							        8: [5, 7],
							    },
							    {
							        0: [6],
							        1: [9],
							        2: [4, 5],
							        3: [4],
							        4: [2, 3],
							        5: [2],
							        6: [0, 7],
							        7: [6],
							        8: [],
							        9: [1],
							    },
							    {
							        0: [4],
							        1: [6],
							        2: [],
							        3: [5, 6, 7],
							        4: [0, 6],
							        5: [3, 8, 9],
							        6: [1, 3, 4, 7],
							        7: [3, 6, 8, 9],
							        8: [5, 7],
							        9: [5, 7],
							    },
							    {
							        0: [1, 3],
							        1: [0, 2, 4],
							        2: [1, 3, 4],
							        3: [0, 2, 4],
							        4: [1, 2, 3],
							    },
							][index]






def 							__lowercase       (			__lowerCAmelCase							:    dict[int, list[int]]       ):
							a__					=					0
							a__					=					len(__lowerCAmelCase       )  # No of vertices in graph
							a__					=					[0] * n
							a__					=					[False] * n

							def dfs(__lowerCAmelCase							:    int ,   __lowerCAmelCase							:    Any ,   __lowerCAmelCase							:    Dict ,   __lowerCAmelCase							:    Tuple       ):
														a__					=					True
														a__					=					id_
														id_ += 1
														for to in graph[at]:
																					if to == parent:
																												pass
																					elif not visited[to]:
																												dfs(__lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase ,   id_       )
																												a__					=					min(low[at] ,   low[to]       )
																												if id_ <= low[to]:
																																			bridges.append((at, to) if at < to else (to, at)       )
																					else:
																												# This edge is a back edge and cannot be a bridge
																												a__					=					min(low[at] ,   low[to]       )

							a__					=					[]
							for i in range(__lowerCAmelCase       ):
														if not visited[i]:
																					dfs(__lowerCAmelCase ,   -1 ,   __lowerCAmelCase ,   id_       )
							return bridges


if __name__ == "__main__":
						import doctest

						doctest.testmod()




