Crossing conveyor logic

I want to modify the logic of Cross
So that he can release objects with the same orientation twice in a row

I need to judge the ID on the tray first, confirm the flow direction, and then make the same direction flow continuously through two trays

Does anyone have good suggestions
For example: