On the bank of a river, there are three temples A, B and C. The river has some magical powers by which it triples the quantity of flowers put into it. Smitha takes some flowers and puts them into the river. Then she divides them into n equal groups and offers one of the groups at temple A. She puts the remaining flowers into the river again. Then, again, forms n equal groups and offers one of these groups at temple B. She puts the remaining flowers into the river again. Then, again, forms n equal groups and offers one of these groups at temple C. The ratio of the number of flowers offered at temple B and the number of flowers remaining after being offered at temple C is 5 : 48. Find the value of n.