solving problem 59