something
Written out, the graph from this problem looks something like this (without edge weights, but with edge direction).
memchr