This one was relatively easy.
Although the structure is a graph, in principle, a simple table
implementation was sufficient due the the limits of the problem.