An interesting puzzle I had to solve.