Need some suggestions about data tree management

Hello everyone,

I was figuring out how to eliminate tree branches logically.
The background is that I want to remove the last branches of each second level path. From the screenshot I want to remove every last branches in a pattern eg. 0;0;(Last path), 0;1;(Last path), 0;2;(Last path) and repeat in the same patter if there is 0;3;(Last path)

I was trying many workarounds like Shift path, filter by coordination, path mapper and so on, but maybe it’s my limitation knowledge so I’m struggle.
Appreciated any helps in advance.

Like this? (15.9 KB)