






def   __lowercase       (			snake_case			):







				"""simple docstring"""






				if not head:
								return True
				# split the list to two parts
				__magic_name__  ,					__magic_name__		:List[str]   =   head.next, head
				while fast and fast.next:
								__magic_name__		:str   =   fast.next.next
								__magic_name__		:int   =   slow.next
				__magic_name__		:Optional[int]   =   slow.next
				__magic_name__		:Optional[Any]   =   None  # Don't forget here! But forget still works!
				# reverse the second part
				__magic_name__		:Optional[int]   =   None
				while second:
								__magic_name__		:List[str]   =   second.next
								__magic_name__		:Dict   =   node
								__magic_name__		:Dict   =   second
								__magic_name__		:Union[str, Any]   =   nxt
				# compare two parts
				# second part has the same or one less node
				while node:
								if node.val != head.val:
												return False
								__magic_name__		:int   =   node.next
								__magic_name__		:Dict   =   head.next
				return True

def   __lowercase       (			snake_case			):







				"""simple docstring"""






				if not head or not head.next:
								return True

				# 1. Get the midpoint (slow)
				__magic_name__		:Dict   =   head
				while fast and fast.next:
								__magic_name__  ,					__magic_name__		:Union[str, Any]   =   fast.next.next, slow.next

				# 2. Push the second half into the stack
				__magic_name__		:Union[str, Any]   =   [slow.val]
				while slow.next:
								__magic_name__		:List[Any]   =   slow.next
								stack.append(slow.val			)

				# 3. Comparison
				while stack:
								if stack.pop() != cur.val:
												return False
								__magic_name__		:Optional[int]   =   cur.next

				return True

def   __lowercase       (			snake_case			):







				"""simple docstring"""






				if not head or not head.next:
								return True
				__magic_name__		:List[str]   =   {}
				__magic_name__		:Optional[Any]   =   0
				while head:
								if head.val in d:
												d[head.val].append(snake_case			)
								else:
												__magic_name__		:Optional[Any]   =   [pos]
								__magic_name__		:Optional[Any]   =   head.next
								pos += 1
				__magic_name__		:Optional[int]   =   pos - 1
				__magic_name__		:Union[str, Any]   =   0
				for v in d.values():
								if len(snake_case			) % 2 != 0:
												middle += 1
								else:
												__magic_name__		:int   =   0
												for i in range(0,	len(snake_case			)			):
																if v[i] + v[len(snake_case			) - 1 - step] != checksum:
																				return False
																step += 1
								if middle > 1:
												return False
				return True












'''simple docstring'''

def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )						->   Optional[Any]:

					'''simple docstring'''

					snake_case_		     =							[False] * len(__UpperCAmelCase      )
					snake_case_		     =							[]
					queue.append(__UpperCAmelCase      )
					snake_case_		     =							True

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

					return visited[t]


def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )						->   Tuple:

					'''simple docstring'''

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

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

										max_flow += path_flow
										snake_case_		     =							sink

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


a    :							List[Any]										=    [
    [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],
]

a						,a    :							int										=    0, 5

print(ford_fulkerson(graph, source, sink))

