Code for problem 126.