Energy relaxation in p- and n-GaAs quantum wells: Confinement effects