In computer science, one thing we love to do is to take specific problems and generalize them. What was specific in path-home (place)? Each place had exactly two paths out of it (if it wasn't a dead-end), but that's not very realistic. Most places have many paths out of them.

Fortunately, the problem statement won't change much. All we do is replace go-left (place) and go-right (place) with go-neighbors (place), which returns a list of neighbor places, each reached by going down a particular path out of that place. For example, using the same graph as before (reprinted for your convenience):

example forest paths

... but you could imagine that some forests might have only one path out of a place, or even a hundred! Like before, calling go-neighbors (place) is an error if place is a dead-end, so go-neighbors (place) will never return a list with no elements.

Write the block generalized-path-home (place) that can handle the generalized forests described above. You will need to use HOFs in your solution, but it will not require drastic changes from your original path-home (place) block.