Take matters into your own hands! Tools that you have: depth-first search, directed acyclic graph. The result we are looking for: a topological sort.
Please note, that the answer should consist only of graph nodes without any braces, spaces, and other symbols.
Oh, almost forgot! The graph:
Answer format: 12345