
def 					lowerCAmelCase__     (    SCREAMING_SNAKE_CASE_	)							->						tuple[int, int]:
			# base case
			if len(SCREAMING_SNAKE_CASE_	) == 1:
						return a[0], a[0]
			else:
						# split A into half.
						lowerCAmelCase__ : List[str]   =						a[: len(SCREAMING_SNAKE_CASE_	) // 2]
						lowerCAmelCase__ : List[Any]   =						a[len(SCREAMING_SNAKE_CASE_	) // 2 :]

						# 2 sub problems, 1/2 of original size.
						lowerCAmelCase__ ,							lowerCAmelCase__ : Optional[Any]   =						max_difference(SCREAMING_SNAKE_CASE_	)
						lowerCAmelCase__ ,							lowerCAmelCase__ : Union[str, Any]   =						max_difference(SCREAMING_SNAKE_CASE_	)

						# get min of first and max of second
						# linear time
						lowerCAmelCase__ : List[str]   =						min(SCREAMING_SNAKE_CASE_	)
						lowerCAmelCase__ : Optional[int]   =						max(SCREAMING_SNAKE_CASE_	)

						# 3 cases, either (small1, big1),
						# (min_first, max_second), (small2, big2)
						# constant comparisons
						if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
									return smalla, biga
						elif biga - smalla > max_second - min_first:
									return smalla, biga
						else:
									return min_first, max_second


if __name__ == "__main__":
					import doctest

					doctest.testmod()

lowerCamelCase__        =						[[0, 1, 1], [0, 0, 1], [1, 0, 0]]







class 	A__				:






				def __init__(		self   : Optional[int]       ,	a   : int  ):






							'''simple docstring'''







							lowerCAmelCase__ : List[str]   =						name
							lowerCAmelCase__ : List[Any]   =						[]
							lowerCAmelCase__ : int   =						[]






				def 				_lowerCamelCase						(		self   : List[str]       ,	a   : Union[str, Any]  ):






							'''simple docstring'''







							self.inbound.append(a  )






				def 				_lowerCamelCase						(		self   : Dict       ,	a   : Union[str, Any]  ):






							'''simple docstring'''







							self.outbound.append(a  )






				def __repr__(		self   : Tuple  ):






							'''simple docstring'''







							return f'''<node={self.name} inbound={self.inbound} outbound={self.outbound}>'''






def 					lowerCAmelCase__     (    SCREAMING_SNAKE_CASE_			,				SCREAMING_SNAKE_CASE_=3			,				SCREAMING_SNAKE_CASE_=0.85	)							->						Optional[Any]:
			lowerCAmelCase__ : Tuple   =						{}
			for node in nodes:
						lowerCAmelCase__ : Union[str, Any]   =						1

			lowerCAmelCase__ : List[str]   =						{}
			for node in nodes:
						lowerCAmelCase__ : str   =						len(node.outbound	)

			for i in range(SCREAMING_SNAKE_CASE_	):
						print(F'''======= Iteration {i + 1} ======='''	)
						for _, node in enumerate(SCREAMING_SNAKE_CASE_	):
									lowerCAmelCase__ : Optional[int]   =						(1 - d) + d * sum(
									    ranks[ib] / outbounds[ib] for ib in node.inbound	)
						print(SCREAMING_SNAKE_CASE_	)
def 					lowerCAmelCase__     (    )							->						Dict:
			lowerCAmelCase__ : List[Any]   =						list(input('Enter Names of the Nodes: '	).split()	)

			lowerCAmelCase__ : Union[str, Any]   =						[Node(SCREAMING_SNAKE_CASE_	) for name in names]

			for ri, row in enumerate(SCREAMING_SNAKE_CASE_	):
						for ci, col in enumerate(SCREAMING_SNAKE_CASE_	):
									if col == 1:
												nodes[ci].add_inbound(names[ri]	)
												nodes[ri].add_outbound(names[ci]	)

			print('======= Nodes ======='	)
			for node in nodes:
						print(SCREAMING_SNAKE_CASE_	)

			page_rank(SCREAMING_SNAKE_CASE_	)


if __name__ == "__main__":
					main()