Solve problem 6