

"""simple docstring"""





_a       =							[
    [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],
]




def   _A  (  UpperCamelCase_     :       List[Any],			UpperCamelCase_     :       Optional[Any],			UpperCamelCase_     :       Tuple,			UpperCamelCase_     :       str)	->						Any:
   '''simple docstring'''


   __lowercase								=						[False] * len(UpperCamelCase_)
   __lowercase								=						[s]
   __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(UpperCamelCase_)
            __lowercase								=						True
            __lowercase								=						u

   return visited[t]




def   _A  (  UpperCamelCase_     :       int,			UpperCamelCase_     :       Tuple,			UpperCamelCase_     :       List[str])	->						Optional[int]:
   '''simple docstring'''


   __lowercase								=						[-1] * (len(UpperCamelCase_))
   __lowercase								=						0
   __lowercase								=						[]
   __lowercase								=						[i[:] for i in graph]  # Record original cut, copy.
   while bfs(UpperCamelCase_,			UpperCamelCase_,			UpperCamelCase_,			UpperCamelCase_):
      __lowercase								=						float("Inf")
      __lowercase								=						sink

      while s != source:
         # Find the minimum value in select path
         __lowercase								=						min(UpperCamelCase_,			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]

   for i in range(len(UpperCamelCase_)):
      for j in range(len(graph[0])):
         if graph[i][j] == 0 and temp[i][j] > 0:
            res.append((i, j))

   return res


if __name__ == "__main__":
   print(mincut(test_graph, source=0, sink=5))












"""simple docstring"""



from __future__ import annotations

from collections.abc import Iterator
from typing import Generic, TypeVar

_UpperCamelCase		:  Any						=		TypeVar('T')

class        a     (   Generic[T]	):







    def __init__(			self							,		_lowerCamelCase       ):
      lowercase							    =       data
      lowercase							    =       None







    def __str__(			self       ):
      return F'{self.data}'


class        a     (   Generic[T]	):







    def __init__(			self       ):
      lowercase							    =       None







    def __iter__(			self       ):
      lowercase							    =       self.top
      while node:
        yield node.data
        lowercase							    =       node.next







    def __str__(			self       ):
      return "->".join([str(_lowerCamelCase       ) for item in self]       )







    def __len__(			self       ):
      return len(tuple(iter(self       )       )       )







    def 			UpperCamelCase_      (			self       ):
      return self.top is None







    def 			UpperCamelCase_      (			self							,		_lowerCamelCase       ):
      lowercase							    =       Node(_lowerCamelCase       )
      if not self.is_empty():
        lowercase							    =       self.top
      lowercase							    =       node







    def 			UpperCamelCase_      (			self       ):
      if self.is_empty():
        raise IndexError('pop from empty stack'       )
      assert isinstance(self.top							,		_lowerCamelCase       )
      lowercase							    =       self.top
      lowercase							    =       self.top.next
      return pop_node.data







    def 			UpperCamelCase_      (			self       ):
      if self.is_empty():
        raise IndexError('peek from empty stack'       )

      assert self.top is not None
      return self.top.data







    def 			UpperCamelCase_      (			self       ):
      lowercase							    =       None


if __name__ == "__main__":
    from doctest import testmod

    testmod()


