and now that we've assigned all the goals to the different sets gt, we can go backwards through the graph, starting from layer m to 1, and search for actions that achieve these goals in the corresponding layers.