which sentence has the correct pronoun and antecedent agreement?

a. When the teachers arrived at school, she saw the students writing with chalk.
b. Because the brothers were tired, he forgot to shut the gate and the dogs ran out.
c. The cat is sitting in the windowsill , and them is basking in the sun.
d. The dogs wagged their tails.

d. The dogs wagged their tails.