



__magic_name__       =     [[0, 1, 1], [0, 0, 1], [1, 0, 0]]


class 	a__       :


					"""simple docstring"""



					def __init__(		self     :Union[str, Any]      ,  lowercase__     :Optional[int]    ):
										lowercase						   =       name
										lowercase						   =       []
										lowercase						   =       []

					def 				__UpperCAmelCase		(		self     :int      ,  lowercase__     :Dict    ):
										self.inbound.append(lowercase__    )

					def 				__UpperCAmelCase		(		self     :Union[str, Any]      ,  lowercase__     :Any    ):
										self.outbound.append(lowercase__    )



					def __repr__(		self     :Tuple    ):
										return F"""<node={self.name} inbound={self.inbound} outbound={self.outbound}>"""





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase=3       ,			_UpperCAmelCase=0.85				):
					"""simple docstring"""






					lowercase						   =       {}
					for node in nodes:
										lowercase						   =       1

					lowercase						   =       {}
					for node in nodes:
										lowercase						   =       len(node.outbound				)

					for i in range(_UpperCAmelCase				):
										print(f"""======= Iteration {i + 1} ======="""				)
										for _, node in enumerate(_UpperCAmelCase				):
															lowercase						   =       (1 - d) + d * sum(
															    ranks[ib] / outbounds[ib] for ib in node.inbound				)
										print(_UpperCAmelCase				)





def 		__snake_case						(    ):
					"""simple docstring"""






					lowercase						   =       list(input('Enter Names of the Nodes: '				).split()				)

					lowercase						   =       [Node(_UpperCAmelCase				) for name in names]

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

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

					page_rank(_UpperCAmelCase				)


if __name__ == "__main__":
		main()











from __future__ import annotations





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase				):
					"""simple docstring"""






					assert (
					    c % greatest_common_divisor(_UpperCAmelCase       ,			_UpperCAmelCase				) == 0
					)  # greatest_common_divisor(a,b) function implemented below
					((lowercase)   ,      (lowercase)   ,      (lowercase))						   =       extended_gcd(_UpperCAmelCase       ,			_UpperCAmelCase				)  # extended_gcd(a,b) function implemented below
					lowercase						   =       c / d
					return (r * x, r * y)





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase = 2				):
					"""simple docstring"""






					((lowercase)   ,      (lowercase))						   =       diophantine(_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase				)  # Initial value
					lowercase						   =       greatest_common_divisor(_UpperCAmelCase       ,			_UpperCAmelCase				)
					lowercase						   =       a // d
					lowercase						   =       b // d

					for i in range(_UpperCAmelCase				):
										lowercase						   =       xa + i * q
										lowercase						   =       ya - i * p
										print(_UpperCAmelCase       ,			_UpperCAmelCase				)





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase				):
					"""simple docstring"""






					if a < b:
										lowercase   ,      lowercase						   =       b, a

					while a % b != 0:
										lowercase   ,      lowercase						   =       b, a % b

					return b





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase				):
					"""simple docstring"""






					assert a >= 0 and b >= 0

					if b == 0:
										lowercase   ,      lowercase   ,      lowercase						   =       a, 1, 0
					else:
										((lowercase)   ,      (lowercase)   ,      (lowercase))						   =       extended_gcd(_UpperCAmelCase       ,			a % b				)
										lowercase						   =       q
										lowercase						   =       p - q * (a // b)

					assert a % d == 0 and b % d == 0
					assert d == a * x + b * y

					return (d, x, y)


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

		testmod(name='''diophantine''', verbose=True)
		testmod(name='''diophantine_all_soln''', verbose=True)
		testmod(name='''extended_gcd''', verbose=True)
		testmod(name='''greatest_common_divisor''', verbose=True)






