Phase-coherent all-optical frequency division by three