Elastic and inelastic scattering of 16O and 12C by 24Mg near the Coulomb barrier