How to access to ancestor transform?

For access to children transform, there is transform.child series, Find method.

But how to access to ancestor transform?

There is transform.root , but this is for topmost transform.

Then how about second, third ancestor transform?

Transform.parent
Which is a Transform, which all have parents to the root.

So I used ,

Transform p1;
Transform p2;

p1 = transform.parent;
p2 = p1.parent;

Originally I wanted direct access to p2 or p3(not topmost parent, so can’t use .root).

What I meant was they all each have parents until they are the root, then they have no parent.