Solution to the chain inspection problem.