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 accountant ignored the guard and never talked to her.
 Gender: female
Example Output: Guard

Example Input: Sentence: The janitor asked the hairdresser some questions and let him in.
 Gender: male
Example Output: Hairdresser

Example Input: Sentence: The guard passed the box to the baker and appreciated his baking skills.
 Gender: male
Example Output:
Baker