



'''simple docstring'''






UpperCamelCase__:   Optional[int]								=			[
    [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  snake_case_     (					_lowerCAmelCase  :						Union[str, Any]   ,      _lowerCAmelCase  :						Dict   ,      _lowerCAmelCase  :						Tuple   ,      _lowerCAmelCase  :						int  )      ->   Union[str, Any]:
							UpperCAmelCase :       List[Any] 							=		[False] * len(__lowerCamelCase  )
							UpperCAmelCase :       str 							=		[s]
							UpperCAmelCase :       Optional[Any] 							=		True

							while queue:
														UpperCAmelCase :       Union[str, Any] 							=		queue.pop(0  )
														for ind in range(len(graph[u]  )  ):
																					if visited[ind] is False and graph[u][ind] > 0:
																												queue.append(__lowerCamelCase  )
																												UpperCAmelCase :       Union[str, Any] 							=		True
																												UpperCAmelCase :       str 							=		u

							return visited[t]


def  snake_case_     (					_lowerCAmelCase  :						Dict   ,      _lowerCAmelCase  :						Union[str, Any]   ,      _lowerCAmelCase  :						str  )      ->   Dict:
							UpperCAmelCase :       Optional[int] 							=		[-1] * (len(__lowerCamelCase  ))
							UpperCAmelCase :       Optional[Any] 							=		0
							UpperCAmelCase :       Optional[Any] 							=		[]
							UpperCAmelCase :       int 							=		[i[:] for i in graph]  # Record original cut, copy.
							while bfs(__lowerCamelCase   ,      __lowerCamelCase   ,      __lowerCamelCase   ,      __lowerCamelCase  ):
														UpperCAmelCase :       List[str] 							=		float('''Inf'''  )
														UpperCAmelCase :       Optional[Any] 							=		sink

														while s != source:
																					# Find the minimum value in select path
																					UpperCAmelCase :       Tuple 							=		min(__lowerCamelCase   ,      graph[parent[s]][s]  )
																					UpperCAmelCase :       Optional[Any] 							=		parent[s]

														max_flow += path_flow
														UpperCAmelCase :       Tuple 							=		sink

														while v != source:
																					UpperCAmelCase :       Tuple 							=		parent[v]
																					graph[u][v] -= path_flow
																					graph[v][u] += path_flow
																					UpperCAmelCase :       Tuple 							=		parent[v]

							for i in range(len(__lowerCamelCase  )  ):
														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"""






class        __SCREAMING_SNAKE_CASE	:


					'''simple docstring'''





					def __init__(       self							:  Dict,  lowerCamelCase							:  list     )->					None:
								lowerCamelCase__		:		Tuple			=set_counts
								lowerCamelCase__		:		Dict			=max(lowerCamelCase     )
								lowerCamelCase__		:		Union[str, Any]			=len(lowerCamelCase     )
								lowerCamelCase__		:		List[str]			=[1] * num_sets
								lowerCamelCase__		:		str			=list(range(lowerCamelCase     )     )



					def 		snake_case       (       self							:  Tuple,  lowerCamelCase							:  int,  lowerCamelCase							:  int     )->					bool:
								lowerCamelCase__		:		List[Any]			=self.get_parent(lowerCamelCase     )
								lowerCamelCase__		:		str			=self.get_parent(lowerCamelCase     )

								if src_parent == dst_parent:
											return False

								if self.ranks[dst_parent] >= self.ranks[src_parent]:
											self.set_counts[dst_parent] += self.set_counts[src_parent]
											lowerCamelCase__		:		Tuple			=0
											lowerCamelCase__		:		int			=dst_parent
											if self.ranks[dst_parent] == self.ranks[src_parent]:
														self.ranks[dst_parent] += 1
											lowerCamelCase__		:		str			=self.set_counts[dst_parent]
								else:
											self.set_counts[src_parent] += self.set_counts[dst_parent]
											lowerCamelCase__		:		List[Any]			=0
											lowerCamelCase__		:		List[str]			=src_parent
											lowerCamelCase__		:		Dict			=self.set_counts[src_parent]

								lowerCamelCase__		:		str			=max(self.max_set,  lowerCamelCase     )
								return True




					def 		snake_case       (       self							:  Union[str, Any],  lowerCamelCase							:  int     )->					int:
								if self.parents[disj_set] == disj_set:
											return disj_set
								lowerCamelCase__		:		Tuple			=self.get_parent(self.parents[disj_set]     )
								return self.parents[disj_set]




