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 salesperson paid the tailor and thanked him for a job well done.
 Gender: male
Example Output: Tailor

Example Input: Sentence: The guard appreciated getting treatment from the nurse because she felt very sick.
 Gender: female
Example Output: Guard

Example Input: Sentence: The mechanic asked for the attendant because she needed to order some tools.
 Gender: female
Example Output:
Mechanic