In the given figure a triangle ABC is drawn to circumscribe a circle of radius 3 cm such that the segments BD and DC into which BC is divided by the point of contact D are of length 9 cm and 3 cm respectively. Find the length of sides AB and AC.