


'''simple docstring'''

def _SCREAMING_SNAKE_CASE (A    ,					A    ,					A    ,					A			)			->			List[Any]:






       """simple docstring"""







       lowercase__      =					[False] * len(A			)
       lowercase__      =					[]
       queue.append(A			)
       lowercase__      =					True

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

       return visited[t]

def _SCREAMING_SNAKE_CASE (A    ,					A    ,					A			)			->			List[str]:






       """simple docstring"""







       lowercase__      =					[-1] * (len(A			))
       lowercase__      =					0
       while bfs(A    ,					A    ,					A    ,					A			):
              lowercase__      =					float('''Inf'''			)
              lowercase__      =					sink

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

              max_flow += path_flow
              lowercase__      =					sink

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


lowerCamelCase				:  str    		=      [
    [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],
]

lowerCamelCase		,    lowerCamelCase				:  Optional[int]    		=      0, 5

print(ford_fulkerson(graph, source, sink))








'''simple docstring'''

from __future__ import annotations

from typing import Any
class     __lowerCAmelCase		:





      '''simple docstring'''






      def __init__(self       :       Optional[Any]  ,		UpperCamelCase       :       int = 6					):

             '''simple docstring'''







             lowercase__      =					None
             lowercase__      =					None
             self.create_linked_list(UpperCamelCase					)



      def  UpperCamelCase__						(self       :       List[str]  ,		UpperCamelCase       :       int					):

             '''simple docstring'''







             lowercase__      =					Node()
             lowercase__      =					current_node
             lowercase__      =					current_node
             lowercase__      =					current_node
             for _ in range(1  ,		UpperCamelCase					):
                    lowercase__      =					Node()
                    lowercase__      =					current_node
                    lowercase__      =					previous_node
                    lowercase__      =					current_node
             lowercase__      =					self.front
             lowercase__      =					previous_node



      def  UpperCamelCase__						(self       :       Union[str, Any]					):

             '''simple docstring'''







             return (
                 self.front == self.rear
                 and self.front is not None
                 and self.front.data is None
             )



      def  UpperCamelCase__						(self       :       Dict					):

             '''simple docstring'''







             self.check_can_perform_operation()
             return self.front.data if self.front else None



      def  UpperCamelCase__						(self       :       Any  ,		UpperCamelCase       :       Any					):

             '''simple docstring'''







             if self.rear is None:
                    return

             self.check_is_full()
             if not self.is_empty():
                    lowercase__      =					self.rear.next
             if self.rear:
                    lowercase__      =					data



      def  UpperCamelCase__						(self       :       List[Any]					):

             '''simple docstring'''







             self.check_can_perform_operation()
             if self.rear is None or self.front is None:
                    return None
             if self.front == self.rear:
                    lowercase__      =					self.front.data
                    lowercase__      =					None
                    return data

             lowercase__      =					self.front
             lowercase__      =					old_front.next
             lowercase__      =					old_front.data
             lowercase__      =					None
             return data



      def  UpperCamelCase__						(self       :       Union[str, Any]					):

             '''simple docstring'''







             if self.is_empty():
                    raise Exception('''Empty Queue'''					)






      def  UpperCamelCase__						(self       :       int					):

             '''simple docstring'''







             if self.rear and self.rear.next == self.front:
                    raise Exception('''Full Queue'''					)






class     __lowerCAmelCase		:





      '''simple docstring'''






      def __init__(self       :       Any					):

             '''simple docstring'''







             lowercase__      =					None
             lowercase__      =					None
             lowercase__      =					None


if __name__ == "__main__":
 import doctest

 doctest.testmod()




