Solve problem 8