"""simple docstring"""


from __future__ import annotations





def       lowerCamelCase_			( __lowerCAmelCase       ,   __lowerCAmelCase    )							-> list[int]:




						'''simple docstring'''



						assert len(__lowerCAmelCase    ) == len(__lowerCAmelCase    )

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

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

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



"""simple docstring"""


from __future__ import annotations

from collections.abc import Generator





def       lowerCamelCase_			( __lowerCAmelCase    )							-> Generator[int, None, None]:




						'''simple docstring'''



						if not isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ) or n < 1:
												raise Exception("Sequence only defined for positive integers"    )

						yield n
						while n != 1:
												if n % 2 == 0:
																		n //= 2
												else:
																		lowerCamelCase__ =3 * n + 1
												yield n





def       lowerCamelCase_			( )							-> List[str]:




						'''simple docstring'''



						lowerCamelCase__ =43
						lowerCamelCase__ =tuple(collatz_sequence(__lowerCAmelCase    )    )
						print(__lowerCAmelCase    )
						print(F'''Collatz sequence from {n} took {len(__lowerCAmelCase    )} steps.'''    )


if __name__ == "__main__":
	main()


