
"""simple docstring"""


def 					_snake_case (						snake_case__      :   int		,					snake_case__      :   str		,					snake_case__      :   List[str]		,					snake_case__      :   Union[str, Any]   ):
	# Return True if there is node that has not iterated.
	A        =      [False] * len(snake_case__   )
	A        =      []
	queue.append(snake_case__   )
	A        =      True

	while queue:
		A        =      queue.pop(0   )
		for ind in range(len(graph[u]   )   ):
			if visited[ind] is False and graph[u][ind] > 0:
				queue.append(snake_case__   )
				A        =      True
				A        =      u

	return visited[t]






def 					_snake_case (						snake_case__      :   Tuple		,					snake_case__      :   Dict		,					snake_case__      :   List[str]   ):
	# This array is filled by BFS and to store path
	A        =      [-1] * (len(snake_case__   ))
	A        =      0
	while bfs(snake_case__		,					snake_case__		,					snake_case__		,					snake_case__   ):
		A        =      float('Inf'   )
		A        =      sink

		while s != source:
			# Find the minimum value in select path
			A        =      min(snake_case__		,					graph[parent[s]][s]   )
			A        =      parent[s]

		max_flow += path_flow
		A        =      sink

		while v != source:
			A        =      parent[v]
			graph[u][v] -= path_flow
			graph[v][u] += path_flow
			A        =      parent[v]
	return max_flow


_lowercase							      = [
    [0, 16, 13, 0, 0, 0],
    [0, 0, 10, 12, 0, 0],
    [0, 4, 0, 0, 14, 0],
    [0, 0, 9, 0, 0, 20],
    [0, 0, 0, 7, 0, 4],
    [0, 0, 0, 0, 0, 0],
]

_lowercase      ,			_lowercase							      = 0, 5


print(ford_fulkerson(graph, source, sink))
'''simple docstring'''




def 				snake_case__							(			_A:					int      ,   _A:					int )    ->	int:

		'''simple docstring'''


		while a != 0:
				lowerCAmelCase					,     lowerCAmelCase   					=  b % a, a
		return b






def 				snake_case__							(			_A:					int      ,   _A:					int )    ->	int:

		'''simple docstring'''


		if gcd(_A      ,   _A ) != 1:
				lowerCAmelCase   					=  f"mod inverse of {a!r} and {m!r} does not exist"
				raise ValueError(_A )
		lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase   					=  1, 0, a
		lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase   					=  0, 1, m
		while va != 0:
				lowerCAmelCase   					=  ua // va
				lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase					,     lowerCAmelCase   					=  (ua - q * va), (ua - q * va), (ua - q * va), va, va, va
		return ua % m




