solving problem12