


'''simple docstring'''
from __future__ import annotations

import sys




def      __snake_case       (       lowerCamelCase_ :				int	,  lowerCamelCase_ :				int						):
				'''simple docstring'''




				if abs(lowerCamelCase_						) == 1:
								return a, 0
				elif abs(lowerCamelCase_						) == 1:
								return 0, b

				__magic_name__  ,      __magic_name__	  = a, b
				__magic_name__  ,      __magic_name__	  = 1, 0
				__magic_name__  ,      __magic_name__	  = 0, 1

				while remainder != 0:
								__magic_name__	  = old_remainder // remainder
								__magic_name__  ,      __magic_name__	  = remainder, old_remainder - quotient * remainder
								__magic_name__  ,      __magic_name__	  = coeff_a, old_coeff_a - quotient * coeff_a
								__magic_name__  ,      __magic_name__	  = coeff_b, old_coeff_b - quotient * coeff_b

				# sign correction for negative numbers
				if a < 0:
								__magic_name__	  = -old_coeff_a
				if b < 0:
								__magic_name__	  = -old_coeff_b

				return old_coeff_a, old_coeff_b




def      __snake_case       (       ):
				'''simple docstring'''




				if len(sys.argv						) < 3:
								print("2 integer arguments required"						)
								return 1
				__magic_name__	  = int(sys.argv[1]						)
				__magic_name__	  = int(sys.argv[2]						)
				print(extended_euclidean_algorithm(lowerCamelCase_	,  lowerCamelCase_						)						)
				return 0


if __name__ == "__main__":
						raise SystemExit(main())







'''simple docstring'''
from __future__ import annotations




def      __snake_case       (       lowerCamelCase_ :				list[list[int]]	,  lowerCamelCase_ :				list[list[int]]						):
				'''simple docstring'''




				assert len(lowerCamelCase_						) == len(lowerCamelCase_						)

				__magic_name__	  = len(lowerCamelCase_						)
				__magic_name__	  = list(range(lowerCamelCase_						)						)
				__magic_name__	  = [-1] * n  # who the donor has donated to
				__magic_name__	  = [-1] * n  # who the recipient has received from
				__magic_name__	  = [0] * n

				while unmatched_donors:
								__magic_name__	  = unmatched_donors[0]
								__magic_name__	  = donor_pref[donor]
								__magic_name__	  = donor_preference[num_donations[donor]]
								num_donations[donor] += 1
								__magic_name__	  = recipient_pref[recipient]
								__magic_name__	  = rec_record[recipient]

								if prev_donor != -1:
												if rec_preference.index(lowerCamelCase_						) > rec_preference.index(lowerCamelCase_						):
																__magic_name__	  = donor
																__magic_name__	  = recipient
																unmatched_donors.append(lowerCamelCase_						)
																unmatched_donors.remove(lowerCamelCase_						)
								else:
												__magic_name__	  = donor
												__magic_name__	  = recipient
												unmatched_donors.remove(lowerCamelCase_						)
				return donor_record



