#11 Solver for problem 29