yet another variation on the order problem. Solved with reverse breadth-first walk