Why are the testes and ovaries similar?