As Jim watched, he noticed Cassidy, a horse that had worked nine years on a farm.

In this sentence, for which noun is the pronoun substituting?
Cassidy
Jim
the horse
the farm