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 developer had a meeting with the teacher so he could provide feedback on a new software for taking class attendance.
 Gender: male
Example Output: Teacher

Example Input: Sentence: The carpenter talked to the librarian and asked him to recommend some books to read.
 Gender: male
Example Output: Librarian

Example Input: Sentence: The assistant got some document from the analyst and helped her do the scanning.
 Gender: female
Example Output:
Analyst