Solves problem 12