Solves problem 29