d32:(2*xA+2*yA+yM-yN)^2+(2*yA+zM+zN)^2;

d12:(2*xA+yA+zM-yN)^2+(yM-yA-zN)^2;

d31:(2*xA+yA+yM+zN)^2+(yA+zM+yN)^2;

solve(d32-d12=0,yM);

solve(d31-d12=0,yM);

yM1(zM):=-((zM+yA)*zN+(yN+yA-2*xA)*zM-yA*yN+3*yA^2+2*xA*yA)/(zN-yN+3*yA+2*xA);

yM1(0);

factor(yM1(0));

yM1(zB);

ratsimp(yM1(zB));

yM2(zM):=-(xA*zN+(yN-xA)*zM+(yA+xA)*yN)/(zN+yA+xA);

yM2(0);

yM2(zB);