Solve #8 by brute force