Reorganize breps

Hi everyone! I have 4 original branches of breps that are organized in columns. However, I am trying to reorganize them in branches when I rotate two of the branches in columns, like in the picture (all reds in one branch; all blues in one branch, and so on with every column of the entire definition):
thank you!

rearrange according to rotation.gh (179.6 KB)

Hi,

from your file it is not clear at all what the task is.
What i have noticed all boxes are organized “per floor”, not in columns as you posted.
So easy fix is to use Flip Matrix.