Nick wants to travel from city A to city B. If he rides a motorcycle for 12 hours then change to bicycle and ride for 9 hours, he will reach city B in time. If he rides bicycle for 21 hours then change to motorcycle and ride for 8 hours, he will reach city B in time also. How long will it take if he rides motorcycle for the whole journey?