Initial implementation of the detecting cycles solution.

Will need to be refactored. The nice algorithm just doesn't handle all
the corner cases well enough.
Detecting cycles solution.

Not the most elegant, since it's the brute force solution, but it
captures all the corner cases, whereas with the tortoise and hare
solution capturing those cases was pretty difficult.