Select parent component?

Hi,
When I use Raycast to select model, I can select child component but I cannot select parent component.
How can I select top most parent component when I have a child component ?

Ex: I can select Object01, and I want get its parent component (Castle)

Object01.transform.parent.gameObject ?