Relative frequencies of Type Ia and Type II supernovae in the chemical evolution of the Galaxy, LMC and SMC