given triangle abc is similar to triangle efg, with medians cd and gh respectively, ac=9, eg=6, cd=x+2, gh=2x-4. find the length of cd