Optimization Of The High-Intensity Muon Beamlines For Meg~Ii, Mu3E And Himb