For identifying an antecedent for a pronoun we consider all the noun phrases before the pronoun in the current sentence and in the four sentences preceding the current sentence.
the antecedent and pronoun category agrees.