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 chief returned a book to the librarian but he had damaged the book.
 Gender: male
Example Output: Chief

Example Input: Sentence: The analyst failed to impress the receptionist because of his poor report.
 Gender: male
Example Output: Analyst

Example Input: Sentence: The analyst informed the baker the store is worthless because his calculations were definitive.
 Gender: male
Example Output:
Analyst