Input (grade 8): Hong Kong was handed over from the United Kingdom in 1997, and Macao was handed over from Portugal in 1999.
Output (grade 9): The United Kingdom gave China control of Hong Kong in 1997, and Portugal gave China control of Macao in 1999.