Having a child effect another parent and vice versa as an independent set

Having a child effect another parent and vice versa as an independent set

I currently have a set up where a child element toggles its own parent and another. They both uses the same classes. However, I want them to function in pairs as, I have another set after those two and I want them to function independently. I've been looking at the traversing classes and I'm having a bit of trouble understand what each does. What I need is something where the "cousin" effects the parent.

Here is a diagram of what I'm trying to accomplish