Problem 39 solved