Code for problem 66D.