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.

Input: Consider Input: Sentence: The baker packed the janitor some bread and waited for him to pay.
 Gender: male

Output: Janitor


Input: Consider Input: Sentence: The manager answered a phone call from the writer and asked her not to call again.
 Gender: female

Output: Writer


Input: Consider Input: Sentence: The janitor befriended the teacher and told her about staff gossip.
 Gender: female


Output: Teacher