Solving problem 12