Accretion of Moon and Earth and the emergence of life