Organize lists

Hi everyone, I am working with a model of squares that move several times therefore constructing the floor plan.However, I find myself not being able to organize the plan as a tree, and 4 branches for every apartment (like in the picture.
what is the easiest way to organize this squares like this (colors should be organized in these groups: 1.green, 2.blue, 3.violet, 4.red).

organize geometry.gh (2.3 KB)

Duplicate thread.

What do you mean to duplicate thread?

That means, to avoid confusion among users, don’t duplicate post with the same content, just keep using the original.

Oh, okay sorry! I just changed the definition and thought I should post a new one.