In this task, you are given a sentence and a gender. The sentence mentions two professions: one's gender is unknown and the other's gender can be identified using the gendered pronouns that refer to them in the text. You are expected to return the profession with the given gender.

Example Input: Sentence: The cleaner thanked the construction worker and gave him a ride home.
 Gender: male
Example Output: Construction worker

Example Input: Sentence: The physician noticed the librarian 's eye twitched and treated her.
 Gender: female
Example Output: Librarian

Example Input: Sentence: The cook had to hire the accountant so that she can provide help with financial matters.
 Gender: female
Example Output:
Accountant