Splitting list of lists such that elements of same tree in one list

Hello,
I am trying to split a list into separate lists such that all the elements of a tree structure are in their individual lists. I used the split component but it works well when we have two tree structure. It basically works as a split list. But what if we have more than 2 tree structure and we want to split it in individual list say A, B, C…
I have attached the script for reference but it unfortunately has only input for two tree structure.

thanks!


Split list of lists.gh (86.7 KB)

Refer to this post. Shift path component should do the job.