Evolution of water on Mars and Earth