Collision2D get the first parent

I have a pendulum with multiple parts, a chain of children, when a gameObject with ‘istrigger’ collides with one of the parts in the chain it becomes the child of that part, when that happens I want to destroy all the colliders on the whole chain/pendulum.
I plan to start at the first part or main parent and iterate through the chain removing each collider until the end of the chain.

I can find the parent of the object I collided with but how would I find the main parent or the containing parent of the whole chain?

If you want to find the highest parent in hierarchy then use:
collider.transform.root

Spot on thanks man