Quantum coherence transfer between an optical cavity and mechanical resonators