Origin and evolution of the layered deposits in the Valles Marineris, Mars