Move parent with child

Hello!

I’m having some issues with a ridiculously simple problem: how to move a parent with a child/ calculate the new position of the parent based on the position where we want the child.

Also i’m using multiple children so a parent could have a child which in turn has its own child etc…

Thank you,
Nikita Makarov

Where head goes, as well as the others.