For an alternative solution, describe the directed graph by listing the nodes and using whitespace to represent the arcs:
$ cat riddle
Vixen Rudolph
Vixen Prancer
Vixen Dasher
Dancer Vixen
Comet Vixen
...
Vixen Dasher
Then use tsort: $ tsort riddle
Dancer
Donder
Comet
Vixen
Blitzen
Dasher
Rudolph
Cupid
Prancer