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 secretary texted the cook what he needed to prepare for the boss.
 Gender: male
Example Output: Cook

Example Input: Sentence: The janitor cleaned for the writer and handed her a note.
 Gender: female
Example Output: Writer

Example Input: Sentence: The analyst chatted with the editor and wanted to collaborate with her.
 Gender: female
Example Output:
Editor